Skip to content

fix: start "Troubleshoot server" in the same working directory as a normal start - #3057

Merged
rchl merged 1 commit into
sublimelsp:mainfrom
rawsun007:troubleshoot-cwd
Oct 8, 2026
Merged

rchl merged 1 commit into
sublimelsp:mainfrom
rawsun007:troubleshoot-cwd

Conversation

@rawsun007

Copy link
Copy Markdown
Contributor

Fixes #3002.

ServerTestRunner started the server with cwd = None unless the config had a plugin, so "LSP: Troubleshoot server" ran a custom server in Sublime Text's own directory, while a normal start via WindowManager.start_async uses the first workspace folder. It also dropped a working directory set by LspPlugin.on_pre_start_async, which WindowManager reads back from context.working_directory. Both now match the normal start.

I could not run the UnitTesting suite here (no Sublime Text or Docker), and there is no existing test for ServerTestRunner. I checked it with a small script that stubs the sublime modules and calls ServerTestRunner.__init__ with a fake transport, recording the cwd passed to start():

case before after
custom config, no plugin None first workspace folder
LspPlugin that sets context.working_directory first workspace folder the plugin's value

ruff check and pyright (1.1.408) are clean on the changed file.

Written by Claude Code under my account in response to the issue report, not found by an audit.

Assisted-By: Claude Code:claude-opus-5-5

…ormal start

ServerTestRunner only used the first workspace folder as the working
directory when the config had a plugin, and ignored a working directory
set by LspPlugin.on_pre_start_async. WindowManager.start_async does both.

Fixes sublimelsp#3002

Assisted-By: Claude Code:claude-opus-5-5
@rchl
rchl merged commit e5bca29 into sublimelsp:main Oct 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Troubleshoot server" uses incorrect working directory

2 participants