🐛 Fix LSP "binary not found" when no workspace folder is open - #106
Merged
Conversation
workspaceRoot() returned the literal string "~" when no workspace folder was open. Node does not expand "~", so it was passed as an invalid cwd to the `just-lsp --version` validation spawn, which threw ENOENT and was misreported as the LSP binary being missing — even with a correct lspPath. Use os.homedir() instead. Fixes #104.
nefrob
approved these changes
Jun 10, 2026
nefrob
left a comment
Owner
There was a problem hiding this comment.
Great find! Will get this released later today.
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.
What changed
When a justfile is opened with no workspace folder (a loose file), the Just LSP no longer fails to start with a spurious
Just LSP binary not found at path: …warning, even whenjust-lspis installed andvscode-just.lspPathis correct.Why
workspaceRoot()fell back to the literal string"~"when there are no workspace folders. Node does not expand~, so it was passed as an invalidcwdto thejust-lsp --versionvalidation spawn (src/lsp.ts), which threwENOENT— and theerrorhandler misreported it as the binary being missing, regardless oflspPath. Reproduces exactly:The fix returns
os.homedir()— the real directory"~"was clearly meant to represent — so the return type staysstringand every caller is unaffected.Things to look out for
workspaceRoot()is also thecwdfor the recipe-runner and launcher spawns (src/recipe.ts,src/launcher.ts), so this additionally gives those a validcwd(instead of"~") when no folder is open.Related
Closes #104.