From 4bace3ab5a777cad10f35f485adc90aca2f00898 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 16 May 2026 20:42:16 +0200 Subject: [PATCH] plan(textarea-editor): fix stale jar reference in autocomplete The Task 9 plan template used the captured \`jar\` closure variable in acceptCompletion, which becomes stale after setLanguage's tear-down-and-remount. Same class of bug Task 4's review caught and fixed. Update the plan to match the correct implementation. --- docs/superpowers/plans/2026-05-16-textarea-code-editor.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md index 80a52ef..82697ac 100644 --- a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md +++ b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md @@ -1024,7 +1024,10 @@ function acceptCompletion(entry) { sel.removeAllRanges(); sel.addRange(range); // Force CodeJar to re-highlight + emit onUpdate. - jar.updateCode(jar.toString()); + // Use instance.jar (not bare `jar` closure) for consistency with + // setLanguage's tear-down-and-remount — the jar reference can be + // swapped at runtime. + instance.jar.updateCode(instance.jar.toString()); hidePopup(); }