You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In-place rename can apply an extension's edit to the wrong text when the IDE is busy #136
Renaming a symbol in place can apply the extension's edit to the wrong characters when the IDE is busy. SplitModeActionsTest > rename formatting and quick fixes from an extension edit the client document failed on Windows: renaming value to renamed in
let value=1;
value;
left
let renamed;
value;
The first line lost its =1, and the second occurrence was not renamed.
In-place rename types the new name into a template. When the template finishes, it puts the old name back, then asks the extension for the real edit. The extension computes that edit on its own copy of the document. The rename waited at most 2 seconds for that copy to hold the name put back, and asked anyway when it had not. On this runner, which logged a 5.5 s UI freeze and a 2 s Dispatchers.Default stall, the extension still held let renamed=1;. It answered "replace the word renamed at [4,11)". By the time that edit was applied, the editor was back to let value=1;, so it replaced value=1. The check before applying (isCurrent) passed: by then the text had been sent to the host, and a rename edit carries no document version.
Every other caller of awaitMirrored gives up when the host has not caught up. Rename ignored the result.
Steps to reproduce
Intermittent: the extension host's copy of the document has to lag more than 2 s behind the editor when the in-place rename's template finishes. Seen in PR #135's CI.
Extension
Any extension with a rename provider. In the test, the workbench probe's codebridgeactions rename provider.
IDE
IntelliJ IDEA IU-263.7307.200
Operating system
Windows (GitHub Actions windows-2025)
IDE mode
Split mode (remote development); the race is in the backend, so it is not specific to split mode.
Run 42891176101, Split-mode UI tests (windows-2025, 1/2), on ci/repeat-one-ui-test — which is master plus one
workflow file, so it carries both fixes:
Timed out waiting for all occurrences renamed in the client after 1m 30s; last observed:
let renamed;
value;
ERROR
Expected let renamed=1;\nrenamed;\nERROR. The =1 is gone.
The offsets say which text the edit was worked out against
The original first line, by index:
index: 0 1 2 3 4 5 6 7 8 9 10 11
chars: l e t _ v a l u e = 1 ;
let renamed; is that line with [4,11) — value=1 — replaced by renamed. Nothing about the
document the edit was applied to makes [4,11) a meaningful range: the identifier there is [4,9).
Now the same line with the typed name, let renamed=1;:
index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
chars: l e t _ r e n a m e d = 1 ;
There the identifier renamed is exactly [4,11).
So the edit was computed in the typed version's coordinates and applied after the old name had
been put back — which is this issue as originally described: "its edit, worked out for that text,
replaced the wrong characters".
The surviving second occurrence fits the same explanation. In the host's copy, line 1 is two
characters longer than in the document, so the edit for line 2's value is offset by two and
lands nowhere that matches; it is dropped or does nothing, and value; stays.
What that means for the fix
3f721a1 waits as long as the rename's cancellable progress shows for the host's copy to hold
the put-back text, and renames nothing if it never catches up. Here it neither waited successfully
nor declined: an edit came back in the typed name's coordinates and was applied. So either the
wait concluded the host had caught up when it had not, or the edit in flight was computed before
it did and the check does not cover that ordering.
Worth noting what is not the cause: the rename test also has a separate, unrelated failure where
the Enter splits the line instead of finishing the template (#154, fix in #155). That one leaves let renamed and =1; on two lines and is a different shape entirely. The two modes are
independent, and #155 will not prevent this one.
CodeBridgeRename logs nothing today, which is why neither this run nor the earlier ones can say
which version the host held when it was asked. If this needs another round, that is the thing to
record: the host's document version at the moment the edit is requested, against the version the
edit is applied to.
Activity
test(rename): judge the host's copy, not who updated it
fix(rename): wait for the host before asking for edits
test(rename): judge the host's copy, not who updated it
BartvHelvert commentedon Nov 10, 2026
Still happening with 3f721a1 and e908d3e in place
Run 42891176101,
Split-mode UI tests (windows-2025, 1/2), onci/repeat-one-ui-test— which is master plus oneworkflow file, so it carries both fixes:
Expected
let renamed=1;\nrenamed;\nERROR. The=1is gone.The offsets say which text the edit was worked out against
The original first line, by index:
let renamed;is that line with [4,11) —value=1— replaced byrenamed. Nothing about thedocument the edit was applied to makes [4,11) a meaningful range: the identifier there is [4,9).
Now the same line with the typed name,
let renamed=1;:There the identifier
renamedis exactly [4,11).So the edit was computed in the typed version's coordinates and applied after the old name had
been put back — which is this issue as originally described: "its edit, worked out for that text,
replaced the wrong characters".
The surviving second occurrence fits the same explanation. In the host's copy, line 1 is two
characters longer than in the document, so the edit for line 2's
valueis offset by two andlands nowhere that matches; it is dropped or does nothing, and
value;stays.What that means for the fix
3f721a1waits as long as the rename's cancellable progress shows for the host's copy to holdthe put-back text, and renames nothing if it never catches up. Here it neither waited successfully
nor declined: an edit came back in the typed name's coordinates and was applied. So either the
wait concluded the host had caught up when it had not, or the edit in flight was computed before
it did and the check does not cover that ordering.
Worth noting what is not the cause: the rename test also has a separate, unrelated failure where
the Enter splits the line instead of finishing the template (#154, fix in #155). That one leaves
let renamedand=1;on two lines and is a different shape entirely. The two modes areindependent, and #155 will not prevent this one.
CodeBridgeRenamelogs nothing today, which is why neither this run nor the earlier ones can saywhich version the host held when it was asked. If this needs another round, that is the thing to
record: the host's document version at the moment the edit is requested, against the version the
edit is applied to.