Repository navigation
fix: adds immediate document saving after applying text edits to trig… - #1235
Merged
angelozerr merged 2 commits intoAug 28, 2025
Conversation
…ger didChangeWatchedFiles request
Contributor
|
@sergeysavchuk thanks for your fix. I don't understand your demo, it seems, before/after demo are the same? |
Contributor
Author
|
@angelozerr Please pay attention to the references result after renaming. Before the fix, didChangeWatchedFiles was not sent, and references were found only in opened files. |
Contributor
|
Let me try it. Could you add please a comment which explains your line code |
Contributor
Author
|
@angelozerr I've added a comment, please review, e.g. before to trigger it, you can exec File -> "Save all" (cmd+S) |
Contributor
|
LGTM, thanks! |
angelozerr
pushed a commit
that referenced
this pull request
Oct 19, 2026
… 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 #1225, fixed by #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.
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.

Ensures immediate VFS events when LSPIJUtils.applyEdits is used on unopened files
Added document saving after applying text edits to trigger VFS events right away.
Tested on Clojure LSP plugin:
Before fix:
before.mov
After fix:
after.mov
Fixes #1225