Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
shinohara-rin committed May 7, 2024
1 parent eaddd67 commit 0819a7b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions apps/language_server/test/server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,45 @@ defmodule ElixirLS.LanguageServer.ServerTest do
wait_until_compiled(server)
end)
end

test "find references if already on definition", %{server: server} do
in_fixture(__DIR__, "clean", fn ->
uri = "file:///file.ex"
code = ~S(
defmodule MyModule do
def func do
func(\)
func(\)
end
end
)
fake_initialize(server)
Server.receive_packet(server, did_open(uri, "elixir", 1, code))
Server.receive_packet(server, definition_req(1, uri, 2, 15))

assert_receive(
response(1, [
%{
"range" => %{
"end" => %{"character" => 16, "line" => 3},
"start" => %{"character" => 12, "line" => 3}
},
"uri" => ^uri
},
%{
"range" => %{
"end" => %{"character" => 16, "line" => 4},
"start" => %{"character" => 12, "line" => 4}
},
"uri" => ^uri
}
]),
3000
)

wait_until_compiled(server)
end)
end
end

describe "textDocument/implementation" do
Expand Down

0 comments on commit 0819a7b

Please sign in to comment.