Repository navigation
Don't start language servers in deleted workspace folders - #3073
Merged
Merged
Conversation
Sublime Text keeps folders in the window after they were deleted from disk. Such folders were used as the server's working directory, which made spawning the process fail, and were also sent to the server as rootUri / workspaceFolders. Skip folders that don't exist when computing the workspace folders for a new session, and fall back to the default working directory when the requested one (possibly provided by a plugin) doesn't exist. Fixes #1491
Contributor
|
Can confirm it's working as intended (log below). Log |
rwols
approved these changes
Oct 18, 2026
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 #1491
Sublime Text keeps folders in the window after they were deleted from disk. LSP used the first such folder as the server's working directory, which made spawning the process fail (e.g.
NotADirectoryErroron Windows). The folder was also sent to the server asrootUri/rootPath/workspaceFolders.Changes:
sorted_workspace_folders()skips folders that don't exist, so they are neither used ascwdnor reported to the server. If all folders are gone, the session starts without workspace folders._start_subprocess()falls back to the default working directory (with a debug log) when the requestedcwddoesn't exist. This also covers acwdreturned from a plugin'son_pre_start.test_longest_prefixnow uses real temp directories since it relied on non-existent paths.Note: a folder deleted while a session is already running is not handled here (ST doesn't report a folder change in that case).