Skip to content

Commit

Permalink
add empty fallback
Browse files Browse the repository at this point in the history
Saw an error in local when i tried to fetch the code actions again
without saving, not really sure if its a good fix but it should stop the
LSP from crashing
  • Loading branch information
mhanberg committed May 1, 2024
1 parent 31dcea8 commit a6b8ddc
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ defmodule NextLS.CredoExtension.CodeAction.RemoveDebugger do
end)

result =
Enum.min_by(results, fn node ->
range = Sourceror.get_range(node)

pos.start[:column] - range.start[:column] + range.end[:column] - pos.end[:column]
end)
Enum.min_by(
results,
fn node ->
range = Sourceror.get_range(node)

pos.start[:column] - range.start[:column] + range.end[:column] - pos.end[:column]
end,
fn -> nil end
)

result =
Enum.find(results, result, fn
Expand Down

0 comments on commit a6b8ddc

Please sign in to comment.