From 3674035a1588796d0c9bf3230846cb44546a2981 Mon Sep 17 00:00:00 2001 From: Fons van der Plas Date: Mon, 14 Oct 2024 12:39:33 +0200 Subject: [PATCH] autocomplete: improve inside-assignment check --- frontend/components/CellInput/pluto_autocomplete.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/components/CellInput/pluto_autocomplete.js b/frontend/components/CellInput/pluto_autocomplete.js index 2d399e563..7c3ccd972 100644 --- a/frontend/components/CellInput/pluto_autocomplete.js +++ b/frontend/components/CellInput/pluto_autocomplete.js @@ -318,7 +318,10 @@ const writing_variable_name_or_keyword = (/** @type {autocomplete.CompletionCont let inside_do_argument_expression = ctx.matchBefore(/do [\(\), \p{L}\p{Nl}\p{Sc}\d_!]*$/u) - return just_finished_a_keyword || after_keyword || inside_do_argument_expression + let node = syntaxTree(ctx.state).resolve(ctx.pos, -1) + let inside_assigment_lhs = node?.name === "Identifier" && node.parent?.name === "AssignmentExpression" && node.nextSibling != null + + return just_finished_a_keyword || after_keyword || inside_do_argument_expression || inside_assigment_lhs } /** @returns {Promise} */