Skip to content

Commit 46c8766

Browse files
committed
format
1 parent 019426d commit 46c8766

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

apps/language_server/lib/language_server/dialyzer/success_typings.ex

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ defmodule ElixirLS.LanguageServer.Dialyzer.SuccessTypings do
33
require Logger
44

55
def suggest_contracts(plt, files) do
6-
{us, results} = :timer.tc(fn ->
7-
modules =
8-
plt
9-
|> :dialyzer_plt.all_modules()
10-
|> :sets.to_list()
6+
{us, results} =
7+
:timer.tc(fn ->
8+
modules =
9+
plt
10+
|> :dialyzer_plt.all_modules()
11+
|> :sets.to_list()
12+
13+
for mod <- modules,
14+
file = source(mod),
15+
file in files,
16+
docs = ElixirSense.Core.Normalized.Code.get_docs(mod, :docs),
17+
{{^mod, fun, arity} = mfa, success_typing} <- success_typings(plt, mod),
18+
:dialyzer_plt.lookup_contract(plt, mfa) == :none,
19+
{stripped_fun, stripped_arity} = SourceFile.strip_macro_prefix({fun, arity}),
20+
line = SourceFile.function_line(mod, stripped_fun, stripped_arity, docs),
21+
is_integer(line) and line > 0,
22+
do:
23+
{file, line, {mod, stripped_fun, stripped_arity}, success_typing,
24+
stripped_fun != fun}
25+
end)
1126

12-
for mod <- modules,
13-
file = source(mod),
14-
file in files,
15-
docs = ElixirSense.Core.Normalized.Code.get_docs(mod, :docs),
16-
{{^mod, fun, arity} = mfa, success_typing} <- success_typings(plt, mod),
17-
:dialyzer_plt.lookup_contract(plt, mfa) == :none,
18-
{stripped_fun, stripped_arity} = SourceFile.strip_macro_prefix({fun, arity}),
19-
line = SourceFile.function_line(mod, stripped_fun, stripped_arity, docs),
20-
is_integer(line) and line > 0,
21-
do: {file, line, {mod, stripped_fun, stripped_arity}, success_typing, stripped_fun != fun}
22-
end)
2327
Logger.info("Success typings computed in #{div(us, 1000)}ms")
2428
results
2529
end

apps/language_server/lib/language_server/parser.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ defmodule ElixirLS.LanguageServer.Parser do
9797
_other ->
9898
ElixirLS.LanguageServer.Server.do_sanity_check()
9999
message = Exception.format_exit(reason)
100+
100101
JsonRpc.telemetry(
101102
"lsp_server_error",
102103
%{
@@ -152,7 +153,7 @@ defmodule ElixirLS.LanguageServer.Parser do
152153
when current_version > old_version ->
153154
%Context{old_file | source_file: source_file}
154155

155-
%Context{source_file: %SourceFile{version: old_version}} = old_file ->
156+
%Context{} = old_file ->
156157
old_file
157158
end)
158159

apps/language_server/lib/language_server/providers/workspace_symbols.ex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,10 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbols do
421421
|> do_process_chunked(fn chunk ->
422422
for {module, path} <- chunk,
423423
Code.ensure_loaded?(module),
424-
docs = if(not String.ends_with?(path, ".erl"), do: ElixirSense.Core.Normalized.Code.get_docs(module, :docs)),
424+
docs =
425+
if(not String.ends_with?(path, ".erl"),
426+
do: ElixirSense.Core.Normalized.Code.get_docs(module, :docs)
427+
),
425428
{function, arity} <- module.module_info(:exports) do
426429
{function, arity} = SourceFile.strip_macro_prefix({function, arity})
427430
location = find_function_location(module, function, arity, path, docs)
@@ -473,7 +476,9 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbols do
473476

474477
send(self, {:indexing_complete, key, results})
475478

476-
Logger.info("[ElixirLS WorkspaceSymbols] #{length(results)} #{key} added to index in #{div(us, 1000)}ms")
479+
Logger.info(
480+
"[ElixirLS WorkspaceSymbols] #{length(results)} #{key} added to index in #{div(us, 1000)}ms"
481+
)
477482
end)
478483

479484
:ok

0 commit comments

Comments
 (0)