From 05b06d64a43de9e988759b08c596f74d1af9a0b1 Mon Sep 17 00:00:00 2001 From: Martino Ferrari Date: Wed, 24 Jun 2026 14:08:11 +0200 Subject: [PATCH] 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 --- web/src/LogicEditor.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/LogicEditor.tsx b/web/src/LogicEditor.tsx index 25478d2..36b8c42 100644 --- a/web/src/LogicEditor.tsx +++ b/web/src/LogicEditor.tsx @@ -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) {