From 45e8da065271bddbf0bf2ec2451ebce9f9911759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Tue, 27 Jul 2021 17:03:07 +0200 Subject: [PATCH] Synchronize Code.Fragment backport --- .../intellisense/identifier_matcher.ex | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/livebook/intellisense/identifier_matcher.ex b/lib/livebook/intellisense/identifier_matcher.ex index 6653855a0..c9ebfa7ba 100644 --- a/lib/livebook/intellisense/identifier_matcher.ex +++ b/lib/livebook/intellisense/identifier_matcher.ex @@ -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