Synchronize Code.Fragment backport

This commit is contained in:
Jonatan Kłosko 2021-07-27 17:03:07 +02:00
parent afe06517d7
commit 45e8da0652

View file

@ -728,20 +728,26 @@ defmodule Livebook.Intellisense.IdentifierMatcher do
{:unquoted_atom, acc, count} ->
{{:unquoted_atom, acc}, count}
{:alias, '.' ++ rest, acc, count} when rest == [] or hd(rest) != ?. ->
nested_alias(rest, count + 1, acc)
{:alias, rest, acc, count} ->
case strip_spaces(rest, count) do
{'.' ++ rest, count} when rest == [] or hd(rest) != ?. ->
nested_alias(rest, count + 1, acc)
{:identifier, '.' ++ rest, acc, count} when rest == [] or hd(rest) != ?. ->
dot(rest, count + 1, acc)
{:alias, _, acc, count} ->
{{:alias, acc}, count}
_ ->
{{:alias, acc}, count}
end
{:identifier, _, acc, count} when call_op? and acc in @textual_operators ->
{{:operator, acc}, count}
{:identifier, _, acc, count} ->
{{:local_or_var, acc}, count}
{:identifier, rest, acc, count} ->
case strip_spaces(rest, count) do
{'.' ++ rest, count} when rest == [] or hd(rest) != ?. ->
dot(rest, count + 1, acc)
_ ->
{{:local_or_var, acc}, count}
end
end
end
@ -795,7 +801,6 @@ defmodule Livebook.Intellisense.IdentifierMatcher do
if ?@ in extra do
:none
else
{rest, count} = strip_spaces(rest, count)
{kind, rest, acc, count}
end
@ -1128,7 +1133,7 @@ defmodule Livebook.Intellisense.IdentifierMatcher do
case :unicode_util.gc(charlist) do
[gc | cont] when is_integer(gc) -> string_reverse_at(cont, n - 1, [gc | acc])
[gc | cont] when is_list(gc) -> string_reverse_at(cont, n - 1, :lists.reverse(gc, acc))
[] -> {[], acc}
[] -> {acc, []}
end
end