Skip to content

Commit 77ff354

Browse files
lukaszsamsonaxelson
authored andcommitted
Fix some dialyzer errors (elixir-editors#103)
* :cwd option expects a charlist * Signature Help Request should return null instead of empty array when no signature found see https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_signatureHelp * ElixirSense.docs never returns nil instead return null when no subject is found see https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_hover
1 parent bc2c612 commit 77ff354

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

apps/elixir_ls_utils/lib/mix.tasks.elixir_ls.release.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule Mix.Tasks.ElixirLs.Release do
3333
if opts[:zip] do
3434
zip_file = to_charlist(Path.expand(opts[:zip]))
3535
files = Enum.map(File.ls!(destination), &to_charlist/1)
36-
:zip.create(zip_file, files, cwd: destination)
36+
:zip.create(zip_file, files, cwd: to_charlist(destination))
3737
end
3838

3939
:ok

apps/language_server/lib/language_server/providers/hover.ex

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ defmodule ElixirLS.LanguageServer.Providers.Hover do
44
"""
55

66
def hover(text, line, character) do
7-
%{subject: subject, docs: docs} = ElixirSense.docs(text, line + 1, character + 1)
7+
response =
8+
case ElixirSense.docs(text, line + 1, character + 1) do
9+
%{subject: ""} ->
10+
nil
811

9-
line_text = Enum.at(String.split(text, "\n"), line)
10-
range = highlight_range(line_text, line, character, subject)
12+
%{subject: subject, docs: docs} ->
13+
line_text = Enum.at(String.split(text, "\n"), line)
14+
range = highlight_range(line_text, line, character, subject)
1115

12-
{:ok, %{"contents" => contents(docs), "range" => range}}
16+
%{"contents" => contents(docs), "range" => range}
17+
end
18+
19+
{:ok, response}
1320
end
1421

1522
## Helpers
1623

17-
defp highlight_range(_line_text, _line, _character, nil) do
18-
nil
19-
end
20-
2124
defp highlight_range(line_text, line, character, substr) do
2225
regex_ranges =
2326
Regex.scan(

apps/language_server/lib/language_server/providers/signature_help.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule ElixirLS.LanguageServer.Providers.SignatureHelp do
1010
}
1111

1212
:none ->
13-
%{"signatures" => []}
13+
nil
1414
end
1515

1616
{:ok, response}

0 commit comments

Comments
 (0)