Skip to content

Commit

Permalink
fix crash on invalid locals_without_parens
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Feb 11, 2024
1 parent c39c42e commit a22ccea
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/language_server/lib/language_server/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,17 @@ defmodule ElixirLS.LanguageServer.Server do

locals_without_parens =
case SourceFile.formatter_for(uri, state.project_dir, state.mix_project?) do
{:ok, {_, opts, _formatter_exs_dir}} -> Keyword.get(opts, :locals_without_parens, [])
{:error, _} -> []
{:ok, {_, opts, _formatter_exs_dir}} ->
locals_without_parens = Keyword.get(opts, :locals_without_parens, [])

if List.improper?(locals_without_parens) do
[]
else
locals_without_parens
end

{:error, _} ->
[]
end
|> MapSet.new()

Expand Down

0 comments on commit a22ccea

Please sign in to comment.