Repository navigation
fix(rename): say which copy the extension answered about - #157
Open
BartvHelvert wants to merge 1 commit into
Open
BartvHelvert wants to merge 1 commit into
BartvHelvert wants to merge 1 commit into
Conversation
`CodeBridgeRename` logged nothing, so a rename that replaced the wrong characters left no way to tell which text the extension had worked its edit out against. Record the host's version where its text cannot say: before the wait, once it holds the editor's text, and once it has answered. What the template puts back is the text that was there before it, so a copy that has seen neither the typing nor the reverting reads to `awaitMirrored` as one that is caught up -- the two are the same string. A version that moves between the wait and the answer is a host that was still applying the typing while it worked the edit out. `mirroredVersion` is the host's own document version, which it already keeps and already reports every so often as edits are mirrored. Refs #136
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Refs #136, which is reopened: an extension's rename edit still lands on the wrong characters with
3f721a1ande908d3eboth in place.CodeBridgeRenamelogs nothing today, so the failures leave no way to tell which text theextension worked its edit out against. This records the host's document version at the three
moments that matter — before the wait, once the host holds the editor's text, and once it has
answered — because the host's text provably cannot distinguish them.
Why the text cannot
edits()waits withawaitMirrored(file, text, …), and that is a string comparison:textis the document after the template put the old name back — which is the same string as thedocument before the template started. So a host copy that has seen neither the typing nor the
reverting is byte-identical to one that has seen both, and the wait returns at once for either.
That is consistent with the failure in
run 42891176101: the
observed
let renamed;is the original line with [4,11) replaced, and [4,11) is exactly wherethe identifier sits in the typed text
let renamed=1;, not in the text the edit was applied to.The arithmetic is on the issue. A host that was still working through the queued typing when it
was asked would answer in precisely those coordinates.
It is also consistent with
e908d3e's unit test passing: that checks the host's copy is theeditor's when the edit is asked for, which is true of a stale copy too.
What this does not do
No behaviour changes, and no fix. The version is read, logged, and otherwise unused.
The fix this points at is to wait on the host's version rather than its text, but I would rather
see one CI failure carrying these three numbers before changing what the wait means — a
version-based wait that is too strict refuses renames that would have worked, and the mirroring
may coalesce edits in ways that are easier to confirm than to reason about.
mirroredVersionis the host's own document version, whichExtensionHostDocumentsalready keepsand
reportEditalready prints every so often.How it was tested
:backend:compileKotlinand:backend:compileTestKotlinpass.HostedWorkerHostsTeststill passes, run through the JUnit platform launcher against themodule's classpath.
:backend:testcannot run on this machine — the IntelliJ Platform plugin probes thedownloaded JBR, which NixOS cannot execute — so the rename unit tests were not run. They do not
touch the changed lines: nothing here alters a decision, only what is written to the log.
Checklist
A new feature has a UI test.Diagnostics for an open bug.No behaviour change.docs/is updated where behaviour changed,docs/status.mdespecially.Third-party material keeps its notice and is listed inNone added.NOTICE.md.