Build the SafeExpression editor's autocomplete source: every registered helper
function (inserted with its call parentheses) plus the identifiers the edited
field's ExpressionScope declares, each carrying its description.
The scope is what makes the offered identifiers right rather than merely
plausible: it is the same declaration the runtime validates against, so
autocomplete cannot suggest a name that construction would reject (issue
#1142 — the editor used to be fed a hand-typed list from a template
attribute, with nothing tying it to the evaluating call site).
This is deliberately CodeMirror-runtime-free — it imports only the
CompletionContext/CompletionResulttypes — so it can be unit-tested in
Node without a browser. The editor module wires the returned source into
autocompletion().
Build the SafeExpression editor's autocomplete source: every registered helper function (inserted with its call parentheses) plus the identifiers the edited field's ExpressionScope declares, each carrying its description.
The scope is what makes the offered identifiers right rather than merely plausible: it is the same declaration the runtime validates against, so autocomplete cannot suggest a name that construction would reject (issue #1142 — the editor used to be fed a hand-typed list from a template attribute, with nothing tying it to the evaluating call site).
This is deliberately CodeMirror-runtime-free — it imports only the
CompletionContext/CompletionResulttypes — so it can be unit-tested in Node without a browser. The editor module wires the returned source intoautocompletion().