Skip to content

Commit c60fd9e

Browse files
committed
add sanity checks in more places
1 parent 27013d3 commit c60fd9e

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

apps/language_server/lib/language_server/dialyzer.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ defmodule ElixirLS.LanguageServer.Dialyzer do
228228
:ok
229229

230230
_other ->
231+
ElixirLS.LanguageServer.Server.do_sanity_check()
231232
message = Exception.format_exit(reason)
232233

233234
JsonRpc.telemetry(

apps/language_server/lib/language_server/ex_unit_test_tracer.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ defmodule ElixirLS.LanguageServer.ExUnitTestTracer do
5151
:ok
5252

5353
_other ->
54+
ElixirLS.LanguageServer.Server.do_sanity_check()
5455
message = Exception.format_exit(reason)
5556

5657
JsonRpc.telemetry(

apps/language_server/lib/language_server/mix_project_cache.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ defmodule ElixirLS.LanguageServer.MixProjectCache do
149149
:ok
150150

151151
_other ->
152+
ElixirLS.LanguageServer.Server.do_sanity_check()
152153
message = Exception.format_exit(reason)
153154

154155
JsonRpc.telemetry(

apps/language_server/lib/language_server/parser.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ defmodule ElixirLS.LanguageServer.Parser do
9595
:ok
9696

9797
_other ->
98+
ElixirLS.LanguageServer.Server.do_sanity_check()
9899
message = Exception.format_exit(reason)
99-
100100
JsonRpc.telemetry(
101101
"lsp_server_error",
102102
%{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbols do
118118
:ok
119119

120120
_other ->
121+
ElixirLS.LanguageServer.Server.do_sanity_check()
121122
message = Exception.format_exit(reason)
122123

123124
JsonRpc.telemetry(

apps/language_server/lib/language_server/server.ex

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ defmodule ElixirLS.LanguageServer.Server do
156156
end
157157

158158
@impl GenServer
159-
def terminate(reason, _state) do
159+
def terminate(reason, state) do
160160
case reason do
161161
:normal ->
162162
:ok
@@ -168,6 +168,7 @@ defmodule ElixirLS.LanguageServer.Server do
168168
:ok
169169

170170
_other ->
171+
do_sanity_check()
171172
message = Exception.format_exit(reason)
172173

173174
JsonRpc.telemetry(
@@ -207,7 +208,7 @@ defmodule ElixirLS.LanguageServer.Server do
207208
{:error, type, msg, send_telemetry} ->
208209
JsonRpc.respond_with_error(id, type, msg)
209210

210-
do_sanity_check(state)
211+
do_sanity_check()
211212

212213
if send_telemetry do
213214
JsonRpc.telemetry(
@@ -419,7 +420,7 @@ defmodule ElixirLS.LanguageServer.Server do
419420
error_msg = Exception.format_exit(reason)
420421
JsonRpc.respond_with_error(id, :internal_error, error_msg)
421422

422-
do_sanity_check(state)
423+
do_sanity_check()
423424

424425
JsonRpc.telemetry(
425426
"lsp_request_error",
@@ -780,7 +781,7 @@ defmodule ElixirLS.LanguageServer.Server do
780781
"retry" => false
781782
})
782783

783-
do_sanity_check(state)
784+
do_sanity_check()
784785

785786
JsonRpc.telemetry(
786787
"lsp_request_error",
@@ -847,7 +848,7 @@ defmodule ElixirLS.LanguageServer.Server do
847848
{:error, type, msg, send_telemetry, state} ->
848849
JsonRpc.respond_with_error(id, type, msg)
849850

850-
do_sanity_check(state)
851+
do_sanity_check()
851852

852853
if send_telemetry do
853854
JsonRpc.telemetry(
@@ -893,7 +894,7 @@ defmodule ElixirLS.LanguageServer.Server do
893894
error_msg = Exception.format(kind, payload, stacktrace)
894895
JsonRpc.respond_with_error(id, :internal_error, error_msg)
895896

896-
do_sanity_check(state)
897+
do_sanity_check()
897898

898899
JsonRpc.telemetry(
899900
"lsp_request_error",
@@ -1481,7 +1482,7 @@ defmodule ElixirLS.LanguageServer.Server do
14811482
end
14821483

14831484
defp handle_build_result(status, diagnostics, state = %__MODULE__{}) do
1484-
do_sanity_check(state)
1485+
do_sanity_check()
14851486

14861487
state =
14871488
if state.needs_build? or status == :error or not dialyzer_enabled?(state) do
@@ -2243,7 +2244,7 @@ defmodule ElixirLS.LanguageServer.Server do
22432244
end
22442245
end
22452246

2246-
defp do_sanity_check(_state) do
2247+
def do_sanity_check() do
22472248
try do
22482249
unless :persistent_term.get(:language_server_test_mode, false) do
22492250
unless function_exported?(ElixirSense, :module_info, 1) and

apps/language_server/lib/language_server/tracer.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ defmodule ElixirLS.LanguageServer.Tracer do
140140
:ok
141141

142142
_other ->
143+
ElixirLS.LanguageServer.Server.do_sanity_check()
143144
message = Exception.format_exit(reason)
144145

145146
JsonRpc.telemetry(

0 commit comments

Comments
 (0)