Skip to content

fix: save the documents a workspace edit changes that are not open in an editor - #1726

Merged
angelozerr merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/save-workspace-edits-without-editor
Oct 19, 2026
Merged

angelozerr merged 2 commits into
redhat-developer:mainfrom
lagergren:fix/save-workspace-edits-without-editor

Conversation

@lagergren

@lagergren lagergren commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Documents that a workspace edit changes but that are not open in an editor are saved again once the edit is applied, so a language server, which reads them from disk, sees the change. This restores the fix of #1225 for renames, code actions, commands and workspace/applyEdit.

Problem

LSPIJUtils.applyWorkspaceEdit changes each document in memory and does not save it. For a document open in an editor, didChange gives the server the new text. For a document with no editor, nothing does. No didOpen was sent for it, so the server reads the file from disk, which keeps the old text until IntelliJ's auto-save writes it. After a rename across files, Find Usages and diagnostics then describe the old code of every closed file. #1225 reported exactly this: after a rename, Find Usages missed the closed files for about 60 seconds.

How it came back:

  1. fix: adds immediate document saving after applying text edits to trig… #1235 fixed didChangeWatchedFiles is not sent immediately to LS after applying edits from rename response #1225 by saving the document after applying the edits.
  2. 54bfc7a made saving a parameter of applyEdits: on (true) for workspace edits, off for completion.
  3. 0c90519, which added willRenameFiles and the other file operations, switched workspace edits to false. Those operations apply their edits in AbstractLSPFileListener.beforeVfsChange(), during a VFS event, where saving a document would write to the VFS while it is being changed. I assume that is why saving was switched off, but the commit does not say. The switch applies to every workspace edit, not only to those. @angelozerr, was that the reason, or did saving cause another problem I should account for?

Why this is a fix

For a document the client has not opened, the server's copy is the file. didClose: "The document’s master now exists where the document’s Uri points to (e.g. if the document’s Uri is a file Uri the master now exists on disk)." didOpen is what hands the content to the client: "The document’s content is now managed by the client and the server must not try to read the document’s content using the document’s Uri."

So an edit that changes only the in-memory copy of a document that is not open leaves the client and the server with different text. Saving it makes the file the server reads match.

Change

  • After the whole edit is applied, applyWorkspaceEdit(edit, label) saves the documents it changed that have no editor and had no unsaved changes before the edit.
    • A document in an editor is kept in sync by didChange and stays unsaved, as before.
    • A document with unsaved changes from before the edit is not saved, so the edit does not persist them.
    • A document whose file a later operation of the same edit deleted is skipped; a renamed file keeps its document.
  • Inside a command, the same documents are saved again after Undo and Redo of the edit. Before the first change to such a document, the edit registers an undoable action that saves them on Undo, which reverts the changes after it first. After the edit, a second action saves them on Redo, which re-applies the changes before it. Both are global, since the documents have no editor to undo them from. An edit that changes only documents in editors registers neither, so its undo is unchanged.
  • A new internal overload takes saveDocumentsWithoutEditor. AbstractLSPFileListener passes false, so the will* edits applied during a VFS event stay unsaved, as now.

Validation

New WorkspaceEditSaveTest, on real files:

Test main With the fix
changes edit to a file without an editor is saved fails: unsaved, old text on disk passes
documentChanges edit to a file without an editor is saved fails: unsaved, old text on disk passes
edit to a file in an editor stays unsaved passes passes
a file with unsaved changes from before the edit stays unsaved passes passes
with saveDocumentsWithoutEditor false, the file stays unsaved (new overload) passes
after Undo the file has the old text and is saved, after Redo the new text fails: global Undo does not reach the edit passes

./gradlew check: 586 tests, 0 failures, the 3 existing skips.

Not included

  • The will* edits applied during a VFS event are still not saved.

… an editor

LSPIJUtils.applyWorkspaceEdit changed documents in memory only. For a document with no editor,
no didOpen gave the server its content, so the server read the old text from disk until
auto-save. This is redhat-developer#1225, fixed by redhat-developer#1235 and kept by 54bfc7a for workspace edits, and back
since 0c90519 switched every workspace edit to not saving. That commit added the will* file
operations, which apply their edits during a VFS event.

applyWorkspaceEdit(edit, label) now saves, once the whole edit is applied, the documents it
changed that have no editor and had no unsaved changes before it. A new internal overload takes
saveDocumentsWithoutEditor; AbstractLSPFileListener passes false for the will* edits it applies
in beforeVfsChange().

Validation:
- New WorkspaceEditSaveTest on real files: a changes edit and a documentChanges edit to a file
  without an editor are saved (both fail on main: unsaved, old text on disk); an edit to a file in
  an editor and to a file with earlier unsaved changes stays unsaved (passes on main too); with
  saveDocumentsWithoutEditor false the file stays unsaved.
- ./gradlew check: 585 tests, 0 failures, the 3 existing skips.

Not included: saving after Undo and Redo of such an edit, and saving the will* edits applied
during a VFS event.
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7d7bcf9e-01d0-4b3a-aef7-c836c8759b66
📥 Commits

Reviewing files that changed from the base of the PR and between b2322e1 and e195517.

📒 Files selected for processing: 2
  • src/main/java/com/redhat/devtools/lsp4ij/LSPIJUtils.java
  • src/test/java/com/redhat/devtools/lsp4ij/WorkspaceEditSaveTest.java
📝 Summary

Summary by CodeRabbit

  • New Features
    • Workspace edits now save changes to files without an open editor, including after undo and redo.
    • Files with existing unsaved changes remain unsaved, and changes to files open in an editor are not automatically saved.
    • Automatic saving can be disabled for workspace edits.

Workspace edits now save eligible documents that have no open editor. The behavior covers text-document edits, existing-file CreateFile operations, and changes entries. Callers can disable saving. Tests cover save conditions and undo/redo persistence.

Changes: Workspace Edit Saving

Layer / File(s) Summary
Track eligible documents before edits
src/main/java/com/redhat/devtools/lsp4ij/LSPIJUtils.java
The default overload enables saving documents without editors. A new overload can disable saving. Eligible documents are tracked before text edits and before an existing target file is cleared by CreateFile.
Save edits and validate persistence
src/main/java/com/redhat/devtools/lsp4ij/LSPIJUtils.java, src/main/java/com/redhat/devtools/lsp4ij/features/files/AbstractLSPFileListener.java, src/test/java/com/redhat/devtools/lsp4ij/WorkspaceEditSaveTest.java
Tracked documents are saved after edits when their files remain valid and they still have no editor. Undo and redo register saves for the corresponding document state. The file listener disables saving. Tests cover edit forms, open editors, pre-existing unsaved changes, disabled saving, and undo/redo.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to e1955

Workspace edits save eligible unopened documents while leaving open or previously unsaved documents alone. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: saving documents changed by a workspace edit when they are not open in an editor.
Description check Passed The description directly explains the problem, the save behavior, the VFS-event exception, undo/redo handling, tests, and validation results.
Linked Issues check Passed Issue #1225 is closed and completed, so it supplies historical context only. No active directly linked issue supplies coding requirements for this pull request. The reported changes and tests address …
Out of Scope Changes check Passed The changes remain within workspace-edit persistence behavior. LSPIJUtils tracks eligible documents, saves them after edits, and handles undo and redo persistence. AbstractLSPFileListener disables sav…
Full details: Linked Issues check

Explanation

Issue #1225 is closed and completed, so it supplies historical context only. No active directly linked issue supplies coding requirements for this pull request. The reported changes and tests address the historical behavior without creating a requirement from the closed issue.

Full details: Out of Scope Changes check

Explanation

The changes remain within workspace-edit persistence behavior. LSPIJUtils tracks eligible documents, saves them after edits, and handles undo and redo persistence. AbstractLSPFileListener disables saving during VFS events. WorkspaceEditSaveTest covers the save and non-save cases. No unrelated change is shown in the pull request summary.

  • Fix all pre-merge checks with AI

Comment @coderabbitai help to get the list of available commands.

@angelozerr

Copy link
Copy Markdown
Contributor

What about Undo and Redo ?

@lagergren

Copy link
Copy Markdown
Collaborator Author

What about Undo and Redo ?

Sorry - They were in my original fix, but I managed to drop them when rebasing. I'll put them back and I need to write some unit tests for them.

…f a workspace edit

Review of redhat-developer#1726 asked about Undo and Redo. Undo of such an edit reverted the documents without an
editor in memory only, and Redo applied it again in memory only, so the server again read a file
that did not match them until auto-save.

Inside a command, applyWorkspaceEdit now registers two undoable actions around the changes to
documents without an editor. The first is registered before the first change to such a document
and saves them on Undo, which reverts the changes after it first. The second is registered after
the edit and saves them on Redo, which re-applies the changes before it. Both save only the
documents saved on apply, and are global, since the documents have no editor to undo them from.
An edit that changes only documents in editors registers neither.

Validation:
- New testUndoAndRedoSaveAFileWithoutAnEditor: after Undo the file has the old text and the
  document is saved; after Redo the new text. Without the actions it fails: global Undo does not
  reach the edit ("Following files affected by this action have been already changed", on main
  too). With the actions registered but not saving, it fails because the document stays unsaved
  after Undo.
- ./gradlew check: 586 tests, 0 failures, the 3 existing skips.
@lagergren

Copy link
Copy Markdown
Collaborator Author

Added in e195517: the documents without an editor are now saved again after Undo and Redo of the edit.

  • Before the first change to such a document, applyWorkspaceEdit registers an undoable action that saves the documents on Undo. Undo reverts the changes after it first, so it saves them as they are after the Undo.
  • After the edit, a second action saves them on Redo, which re-applies the changes before reaching it.
  • Both save only the documents saved on apply: no editor, and no unsaved changes before the edit. An edit that changes only documents in editors registers neither, so its undo is unchanged.
  • The actions are global, since the documents have no editor to undo them from. On main, global Undo does not reach such an edit at all: in the new test it reaches the previous command instead and refuses it ("Following files affected by this action have been already changed").

New testUndoAndRedoSaveAFileWithoutAnEditor: after Undo, the file on disk has the old text again and the document is saved; after Redo, the new text. With the actions registered but not saving, it fails because the document stays unsaved after Undo. ./gradlew check: 586 tests, 0 failures, the 3 existing skips.

@angelozerr angelozerr added the bug Something isn't working label Oct 19, 2026
@angelozerr angelozerr added this to the 0.21.1 milestone Oct 19, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Oct 19, 2026
@angelozerr
angelozerr merged commit 88b9ece into redhat-developer:main Oct 19, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Java Tooling Oct 19, 2026
angelozerr pushed a commit that referenced this pull request Oct 19, 2026
…dits change

#1726 made applyWorkspaceEdit save the documents without an editor that a workspace edit changes,
except for the edits of willRenameFiles, willCreateFiles and willDeleteFiles:
AbstractLSPFileListener applies those in beforeVfsChange(), during the VFS event, where a document
cannot be saved. They stayed unsaved until auto-save, so after a rename whose server edits other
files, the server kept reading the old text of every closed file it edited.

The internal applyWorkspaceEdit(edit, label, saveDocumentsWithoutEditor) now returns the documents
without an editor it changed that had no unsaved changes before, also when it does not save them,
and saveDocumentsWithoutEditor(documents) becomes internal API. AbstractLSPFileListener collects
them in beforeVfsChange() and saves them in afterVfsChange() with invokeLater, after the write
action the VFS event runs in.

Validation:
- New FileOperationEditSaveTest: renaming a connected file whose server answers willRenameFiles
  with an edit to another file without an editor saves that file with the new text. On main it
  fails ("the edited file without an editor must be saved"); with the fix it passes.
- WorkspaceEditSaveTest: one lambda becomes a block, since the overload now returns a value.
- ./gradlew check: 592 tests, 0 failures, the 3 existing skips.

Not included: Undo and Redo of the rename do not save these documents; #1726's undoable actions
are registered only where the edit itself is saved.
@lagergren
lagergren deleted the fix/save-workspace-edits-without-editor branch October 26, 2026 21:43
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 27, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 27, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 27, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 27, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 28, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 28, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 29, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 29, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 30, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Nov 30, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
lagergren added a commit to xtclang/xvm that referenced this pull request Dec 1, 2026
…changes, which LSP4IJ 0.30.1 does (UP21)

ClosedRefactoringDocuments saved the closed documents that XtcRenameEdit's edit changed, after the edit and after its
Undo and Redo, because LSP4IJ 0.21.0 left them unsaved and the server, which reads closed files from disk, proved and
compiled stale text (UP21). LSP4IJ 0.30.1 saves them itself (redhat-developer/lsp4ij#1726, #1731), and on 2026-11-23 the
save stayed only for a rename that also moves its directory, X116 having then failed 4 of 10 runs without it. It
doesn't now: with the save turned off, X109-X116 passed 10 runs of 10 and X116, X161-X163 and X169 (the closed
consumers' disk text after a rename, its Undo and its Redo) 3 of 3, on errs f3c5684 with LSP4IJ 0.30.1 (throwaway
runs, 2026-11-27). What it kept is its guard, now UnsavedClosedTargets: a rename that reaches a closed document with
unsaved changes, or a target IntelliJ cannot resolve, is refused, since the server proved it against the files on
disk.

Validated: :lang:intellij-plugin:test, 249 tests, 0 failures, 0 skipped; integrationTestClasses without warnings;
:lang:spotlessCheck and :lang:detekt clean. In the container, on this commit: X109-X116, X161-X163 and X169,
with START 13 of 13 passed (run-9127043804915393586).

Limits: the 10 and 3 runs bound the failure rate the bridge once guarded against, not prove it zero; a run that loses
a closed consumer's edit again shows in X116 or X169.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

didChangeWatchedFiles is not sent immediately to LS after applying edits from rename response

2 participants