Skip to content

Commit 494b1a6

Browse files
committed
Reject attributes in debug adapter completions
fix crash when attributes are returned from completion engine
1 parent f3acaf8 commit 494b1a6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

apps/debug_adapter/lib/debug_adapter/completions.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,7 @@ defmodule ElixirLS.DebugAdapter.Completions do
6464
label: name
6565
}
6666
end
67+
68+
# reject attributes as expansion will fail anyway
69+
def map(%{type: :attribute}), do: nil
6770
end

apps/debug_adapter/lib/debug_adapter/server.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,7 @@ defmodule ElixirLS.DebugAdapter.Server do
14781478
results =
14791479
ElixirLS.Utils.CompletionEngine.complete(prefix, env, metadata, cursor_position)
14801480
|> Enum.map(&ElixirLS.DebugAdapter.Completions.map/1)
1481+
|> Enum.reject(&is_nil/1)
14811482

14821483
%{"targets" => results}
14831484
end

0 commit comments

Comments
 (0)