@@ -46,6 +46,24 @@ defmodule ElixirLS.LanguageServer.ServerTest do
46
46
assert_receive ( % { "id" => 1 , "result" => % { "capabilities" => % { } } } , 1000 )
47
47
end
48
48
49
+ test "Execute commands should include the server instance id" , % { server: server } do
50
+ # If a command does not include the server instance id then it will cause
51
+ # vscode-elixir-ls to fail to start up on multi-root workspaces.
52
+ # Example: https://github.com/elixir-lsp/elixir-ls/pull/505
53
+
54
+ Server . receive_packet ( server , initialize_req ( 1 , root_uri ( ) , % { } ) )
55
+ assert_receive ( % { "id" => 1 , "result" => all = % { "capabilities" => capabilities } } , 1000 )
56
+
57
+ commands = get_in ( capabilities , [ "executeCommandProvider" , "commands" ] )
58
+ server_instance_id = :sys . get_state ( server ) . server_instance_id
59
+
60
+ Enum . each ( commands , fn command ->
61
+ assert String . contains? ( command , server_instance_id )
62
+ end )
63
+
64
+ refute Enum . empty? ( commands )
65
+ end
66
+
49
67
test "returns -32600 InvalidRequest when already initialized" , % { server: server } do
50
68
Server . receive_packet ( server , initialize_req ( 1 , root_uri ( ) , % { } ) )
51
69
assert_receive ( % { "id" => 1 , "result" => % { "capabilities" => % { } } } , 1000 )
0 commit comments