We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3645148 commit 1b41c05Copy full SHA for 1b41c05
apps/language_server/lib/language_server/protocol/location.ex
@@ -17,11 +17,16 @@ defmodule ElixirLS.LanguageServer.Protocol.Location do
17
_ -> SourceFile.path_to_uri(file)
18
end
19
20
+ # LSP messages are 0 indexed whilst elixir/erlang is 1 indexed.
21
+ # Guard against malformed line or column values.
22
+ line = max(line - 1, 0)
23
+ column = max(column - 1, 0)
24
+
25
%Protocol.Location{
26
uri: uri,
27
range: %{
- "start" => %{"line" => line - 1, "character" => column - 1},
- "end" => %{"line" => line - 1, "character" => column - 1}
28
+ "start" => %{"line" => line, "character" => column},
29
+ "end" => %{"line" => line, "character" => column}
30
}
31
32
0 commit comments