feat(editor): suggest declared array locals in array-name autocomplete
The flow-array-names datalist (used by the export-CSV node columns and the legacy accumulate/clear nodes) was sourced only from array names already referenced by other nodes, so a freshly declared array local would not appear as an autocomplete suggestion until it was typed somewhere. Seed the datalist with declared array statevars first, then node-referenced names. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -577,9 +577,13 @@ export default function LogicEditor({ graph, onChange, widgets = [], statevars,
|
||||
|
||||
// Array names already referenced by accumulate/export/clear nodes, offered as
|
||||
// autocomplete suggestions so the same array is reused across nodes.
|
||||
const arrayNames = Array.from(new Set(
|
||||
nodes.map(n => n.params.array).filter((a): a is string => !!a)
|
||||
));
|
||||
// Suggestions for the array-name autocomplete (export columns, accumulate,
|
||||
// clear): declared array locals first, then any names already referenced by
|
||||
// nodes (covers legacy/in-flight names not yet declared).
|
||||
const arrayNames = Array.from(new Set([
|
||||
...(statevars ?? []).filter(v => v.type === 'array').map(v => v.name),
|
||||
...nodes.map(n => n.params.array).filter((a): a is string => !!a),
|
||||
]));
|
||||
|
||||
// Append a {ds:name} reference into a node's expression field.
|
||||
function insertRef(id: string, field: string, ds: string, sig: string) {
|
||||
|
||||
Reference in New Issue
Block a user