Repository navigation
fix(language-server): accept a typescript.tsdk package folder, warn when the folder has no TypeScript (#1013) - #1015
Merged
Conversation
…ib folder (#1013) The typescript.tsdk startup option must name the lib folder of a TypeScript install. When it named another folder, such as the typescript package folder or a wrong path, the classic backend skipped it, used the project's typescript, and told the user nothing. The server now sends a window/showMessage warning that names the folder, gives the lib folder to use when the folder is the typescript package, and names the TypeScript it runs instead. When it then finds no TypeScript it can run, the existing warning follows as a second message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ipt.tsdk When typescript.tsdk names the typescript package folder instead of its lib folder, use its lib folder rather than warn. The warning is now only for a folder with no TypeScript, and reads in order: what is wrong, which TypeScript the server uses instead (the project's, or the one next to the server), and how to set the option. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rewrite the typescript.tsdk, no-TypeScript and TypeScript 7 warnings in short, active sentences: first the effect, then the cause, then one action per sentence. One name for each thing: "TypeScript", "the typescript.tsdk startup option", "the server installation". Update the Neovim and Zed editor-test patterns to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rnings Put the negation on the verb: "does not contain TypeScript", "did not find TypeScript", "does not give type checking". Same in the README, the changeset, and the comments and test names of this change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first sentence of the no-TypeScript and TypeScript 7 warnings said "The TSRX language server does not provide type checking, …", which reads like a fact about the product when nothing comes before it. Open with what the server found, then "Because of this, the server does not provide …". Co-Authored-By: Claude Opus 5.5 <[email protected]>
… warnings Replace "Because of this, the server does not provide …" with "The TSRX language server will not be able to provide …" after the cause sentence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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 #1013.
What changes
Project on TypeScript 5.9.3, TypeScript 6.0.2 installed in
/ts6:typescript.tsdk/ts6/node_modules/typescript/lib/ts6/node_modules/typescript(the package folder)/ts6/typo/lib(does not contain TypeScript)The package folder works. When the folder is the
typescriptpackage itself, the server uses itslibfolder. Picking the package folder instead oflibis the easy mistake from the issue, and the server can fix it without asking the user.A folder that does not contain TypeScript gets a warning. For
/ts6/typo/lib:(One line in the editor; split here to read more easily.)
Plainer warnings. All three warnings now follow the ASD-STE100-style rules: short, active sentences; first the cause, then its effect, then one action per sentence; one name for each thing. For example, the TypeScript 7 warning:
Before: "The TSRX language server found typescript 7.1.0-dev.20261002.1 at /project/node_modules/typescript. It cannot run TypeScript 7 or newer, so type checking, hover and completions in .tsrx files are off. …"
This only applies on the
classicbackend, when the editor passestypescript.tsdk: Zed, Neovim and Sublime Text throughinitializationOptions, and the JetBrains plugin through Settings → Languages & Frameworks → TSRX → TypeScript lib folder (#1012). VS Code uses thepluginbackend and passes notsdk, so nothing changes there.How
find-typescript.js:find_typescripttries the option's folder as thelibfolder first, then as the package folder.tsdk_notice(tsdk, found)writes the warning.typescript_notice(no TypeScript, TypeScript 7) is reworded; the facts and actions stay the same.server.js: whentypescript.tsdkis set and the TypeScript found did not come from it, the server adds thetsdkwarning. The warnings are now a list, and each one is sent as its ownwindow/showMessagenotification afterinitialized.backend.js: the comment onresolve_typescript_tsdksaid the server falls back to thetypescriptnext to itself. Since fix(language-server): find the project's typescript, and start without one (#1008) #1011 it searches the project first.nvim-pluginandzed-plugineditor tests: the warning patterns match the new texts. The 4 Neovim scenarios pass locally (headless Neovim); the Zed scenarios were not run.Tests
findTypeScript.test.js:find_typescriptaccepts thelibfolder and the package folder, and skips folders that do not contain TypeScript.tsdkwarning when the fallback TypeScript is the project's, the server's, or none.typescriptDiscoveryLsp.test.jsruns the built server over stdio, the way other editors start it:tsdkis the package folder and the project has TypeScript 7: TypeScript features are on, with no warning.tsdkis a missing folder and the project has TypeScript 5.9: TypeScript features are on, with one warning (exact text).tsdkis a missing folder and the project has TypeScript 7: thetsdkwarning comes first, then the TypeScript 7 warning.All three fail on main and pass here. Both warnings arrive right after
initialized, so the session helper now starts waiting for the first and the second warning beforeinitialize.Local runs:
pnpm vitest run --project language-server(158 passed),tsc -p packages/language-server/tsconfig.typecheck.json,prettier --check,pnpm changeset:check.Repro script
🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to TypeScript discovery and user-facing warnings on the classic backend; VS Code’s plugin backend is unaffected.
Overview
Fixes
typescript.tsdkhandling on the classic backend so editors can pass either the TypeScriptlibdirectory or thetypescriptpackage folder (e.g.node_modules/typescript). Invalid or empty paths are no longer ignored silently: the server emits a newtsdk_noticewarning naming the bad folder, which TypeScript it uses instead (when applicable), and how to set the option, then continues workspace/server discovery.No-TypeScript and TypeScript 7 user messages are reworded into shorter, clearer sentences (impact → cause → action). Warnings are collected in a list and each is sent as its own
window/showMessageafter init, so a badtsdkcan appear before the TS7/missing-package warning. README and changeset document the behavior; unit, LSP integration, and Neovim/Zed editor tests assert the new resolution and copy.Reviewed by Cursor Bugbot for commit 37d0903. Bugbot is set up for automated code reviews on this repo. Configure here.