Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function call and match error repair #1572

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/els_lsp/src/els_code_actions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ fix_atom_typo(Uri, Range, _Data, [Atom]) ->

-spec extract_function(uri(), range()) -> [map()].
extract_function(Uri, Range) ->
{ok, [Document]} = els_dt_document:lookup(Uri),
{ok, Document} = els_utils:lookup_document(Uri),
PoiRange = els_range:to_poi_range(Range),
#{from := From = {Line, Column}, to := To} = PoiRange,
%% We only want to extract if selection is large enough
Expand Down Expand Up @@ -766,8 +766,6 @@ format_args(Document, Arity, Range) ->
end.

-spec guess_indentation([binary()]) -> pos_integer().
guess_indentation([]) ->
2;
guess_indentation([A, B | Rest]) ->
ACount = count_leading_spaces(A, 0),
BCount = count_leading_spaces(B, 0),
Expand All @@ -776,7 +774,9 @@ guess_indentation([A, B | Rest]) ->
N;
{_, _} ->
guess_indentation([B | Rest])
end.
end;
guess_indentation(_) ->
2.

-spec count_leading_spaces(binary(), non_neg_integer()) -> non_neg_integer().
count_leading_spaces(<<>>, _Acc) ->
Expand Down