Skip to content

Commit

Permalink
guess_indentation 函数容错
Browse files Browse the repository at this point in the history
  • Loading branch information
shuying2244 committed Dec 6, 2024
1 parent 43aaa8e commit fed3cbf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/els_lsp/src/els_code_actions.erl
Original file line number Diff line number Diff line change
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

0 comments on commit fed3cbf

Please sign in to comment.