Skip to content

Commit

Permalink
autocomplete: improve inside-assignment check
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp committed Oct 14, 2024
1 parent 11a1825 commit 3674035
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/components/CellInput/pluto_autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<autocomplete.CompletionResult?>} */
Expand Down

0 comments on commit 3674035

Please sign in to comment.