Fix TypeScript LSP startup without global binary#57
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the TypeScript LSP startup path so a globally installed typescript-language-server is no longer required. Resolution now walks user-configured → workspace-local (node_modules/.bin wrapper or the package's cli.mjs) → CastCodes-managed install → PATH, and the Codebase Indexing settings page surfaces an "Install/repair" affordance when the TypeScript server is missing.
Changes:
- Introduce
resolve_lsp_binary_configplusLspBinarySource/ResolvedLspBinaryConfigand an actionable missing-binary error message, and addTypeScriptLanguageServerCandidate::find_workspace_binary_configto discover workspace-local installs. - Rework
LspServerConfig::command_and_paramsto use the new four-source resolution order and carry an optional user-configuredCustomBinaryConfig. - In the Code settings page, detect a repairable TypeScript failure via error-string matching and render an "Install/repair" button, replacing the badge text accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/lsp/src/supported_servers.rs | Adds resolution types, the actionable error message, the per-server workspace probe dispatch, and unit tests. |
| crates/lsp/src/servers/typescript_language_server.rs | Adds workspace-local discovery for node_modules/.bin/typescript-language-server and cli.mjs, with --version verification. |
| crates/lsp/src/config.rs | Stores an optional custom binary on LspServerConfig and rewrites startup resolution to use resolve_lsp_binary_config. |
| app/src/settings_view/code_page.rs | Adds the repair button + status text for the missing-binary failure and tears down the server before reinstall. |
Comments suppressed due to low confidence (1)
app/src/settings_view/code_page.rs:2105
- The repairable-failure detection relies on substring-matching the error message against the human-readable label
TYPESCRIPT_LSP_REPAIR_LABEL("Install/repair TypeScript language server"). This creates a brittle coupling: any future change to the wording inactionable_missing_binary_message(e.g., localization, rephrasing) will silently break the UI's ability to surface the repair button, and conversely any unrelated failure message that happens to contain this phrase will spuriously show the repair UI. Consider propagating this state structurally — for example, by exposing a typed reason onLspState::Failed(aMissingBinarykind or a dedicated error code) — rather than parsing a free-form error string.
fn is_repairable_lsp_failure(
&self,
server_model: Option<&warpui::ModelHandle<LspServerModel>>,
server_type: LSPServerType,
app: &AppContext,
) -> bool {
server_type == LSPServerType::TypeScriptLanguageServer
&& server_model.is_some_and(|model| {
matches!(
model.as_ref(app).state(),
LspState::Failed { error } if error.contains(TYPESCRIPT_LSP_REPAIR_LABEL)
)
})
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
Author
|
@copilot apply changes based on the comments in this thread |
Copilot stopped work on behalf of
BunsDev due to an error
May 18, 2026 10:07
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.
Summary
typescript-language-server.node_modules/.bin/typescript-language-serverand package CLI installs before falling back.Temporary workaround
Until this ships, users can install the TypeScript server locally in the target repo:
After this change, users can also use Settings > Codebase Indexing >
Install/repair TypeScript language server; no global PATH install is required.Verification
rustfmt --check app/src/settings_view/code_page.rs crates/lsp/src/config.rs crates/lsp/src/servers/typescript_language_server.rs crates/lsp/src/supported_servers.rsgit diff --cached --checkcargo test -p lsp --features local_fs supported_servers::testscargo check -p warp-app --bin cast-codes --features gui,cast-agentNote: the app compile gate passes with existing warnings in unrelated modules.