Repository navigation
fix: the document of a deleted file is closed, also when no editor has the file open - #2340
Merged
lagergren merged 2 commits intoNov 30, 2026
Merged
Conversation
…s the file open A file connected for a request without an editor, as for the inline values of a stopped debug session, stayed connected after its delete: no didClose, an opened document with an invalid file, and a new file at the same URL served the deleted text. The delete now disconnects every document whose file it removed, the files of a deleted directory included, before the file operations are sent. A language server left without a document then follows its idle-stop policy, as after the close of its last editor.
…ects the deleted file A connection that waited, as for the language server to start, while its file was deleted registered the document after the delete had disconnected the deleted files, so it stayed connected. A connection now checks that its file is valid, under the lock that the delete takes, before it registers the document.
This was referenced Nov 28, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2340 +/- ##
==========================================
+ Coverage 58.64% 58.67% +0.02%
==========================================
Files 849 849
Lines 36719 36744 +25
Branches 7609 7616 +7
==========================================
+ Hits 21535 21559 +24
Misses 12186 12186
- Partials 2998 2999 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #2335, for 0.30.3.
Behaviour changes
One commit each, to be rebase-merged.
textDocument/didClosefor each document whose file it removed, the files of a deleted directory included, and drops the document, beforeworkspace/didDeleteFilesandworkspace/didChangeWatchedFiles. Before, only the close of an editor disconnected a document. So a document connected without an editor, as for the inline values of a stopped debug session, stayed connected with an invalid file, its diagnostics kept being pulled, and a new file at the same URL got the deleted file's text. A language server left without a document then follows its idle-stop policy, as after the close of its last editor.Tests
DeletedFileDocumentTest, 6 tests. Each fails against its commit's parentsrc/main:testTheDocumentOfADeletedFileWithAnEditorIsClosedfails againstmainonly because of the light test fixture: its editor manager still reports the editor when the close event comes, soLSPFileListener.fileClosedignored the close. In the IDE, the close of the editor of a deleted file should already disconnect its document. That isn't checked.The full suite passes locally on macOS, on IC 2024.2: 2,658 tests, 0 failures, 0 errors, 7 skipped.
Not in this PR
A document connected without an editor still stays connected while its file exists, until a delete, a move or the language server's stop. Closing it once its request has the answer, the "ideally" of #2335, isn't done:
didOpenanddidClosearound each stop and eachworkspace/inlineValue/refreshin a file that no editor shows;