Skip to content

fix(lsp): start npm-installed language servers on Windows - #517

Merged
mrnasil merged 1 commit into
mainfrom
fix/lsp-windows-shim-lookup
Nov 27, 2026
Merged

mrnasil merged 1 commit into
mainfrom
fix/lsp-windows-shim-lookup

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 27, 2026

Copy link
Copy Markdown
Member

Problem

On Windows the lsp tool found npm-installed servers on PATH and then failed to start them with %1 is not a valid Win32 application (os error 193).

npm writes a POSIX sh script next to each .cmd shim (pyright-langserver and pyright-langserver.cmd). lookup_in_dir_with_exts tried the bare name first, and off Unix every regular file counts as executable, so it returned the script. That covers every npm-installed server: TypeScript, Pyright, bash, JSON, YAML.

Reproduced on a Windows 11 machine with the real npx pair: starting npx fails with error 193, npx.cmd runs.

Fix

PATHEXT candidates are tried before the bare name. Unix has no PATHEXT, so the lookup is unchanged there.

Verification

  • lookup_prefers_a_pathext_shim_over_the_extensionless_script fails on main (returns tool, not tool.CMD) and passes here.
  • cargo test -p whycodes-lsp: 128 passed. Clippy, fmt, budget scripts: green.
  • Coverage: detect.rs measured locally after cargo llvm-cov clean, no uncovered lines. The full scripts/coverage.sh workspace run was not done locally.
  • Not done: starting a real npm-installed language server end to end through the lsp tool; none is installed on this machine.
  • docs/knowhow.md has the entry.

🤖 Generated with Claude Code

npm writes a POSIX sh script next to each .cmd shim (pyright-langserver
and pyright-langserver.cmd). The lookup tried the bare name first, and
off Unix every regular file counts as executable, so it returned the
script. Starting it failed with os error 193, so no npm-installed
server (TypeScript, Pyright, bash, JSON, YAML) ever ran on Windows.

PATHEXT candidates are now tried before the bare name. Unix has no
PATHEXT, so nothing changes there.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@mrnasil
mrnasil merged commit 0906246 into main Nov 27, 2026
7 checks passed
@mrnasil
mrnasil deleted the fix/lsp-windows-shim-lookup branch November 27, 2026 21:53
@mrnasil mrnasil mentioned this pull request Nov 28, 2026
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.

1 participant