diff --git a/lib/next_ls/extensions/credo_extension/code_action/remove_debugger.ex b/lib/next_ls/extensions/credo_extension/code_action/remove_debugger.ex index 281f4cfe..19ce29fc 100644 --- a/lib/next_ls/extensions/credo_extension/code_action/remove_debugger.ex +++ b/lib/next_ls/extensions/credo_extension/code_action/remove_debugger.ex @@ -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