Harden TypeScript LSP startup repair state#60
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens TypeScript LSP startup/repair handling by introducing a typed startup-failure reason (instead of parsing error text) and ensuring managed npm installs land in CastCodes’ managed language-server directory via npm --prefix.
Changes:
- Introduces
LspStartupError+LspStartupFailureReason::MissingBinary { server_type }and propagates that throughLspState::Failed. - Updates the settings UI to use the typed failure reason for showing the “Install/repair” affordance.
- Pins managed TypeScript LSP installs to the managed install directory using
npm install --prefix <install_dir> ..., and adds smoke tests.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/lsp/src/supported_servers.rs | Adds typed startup error/reason and returns it from missing-binary resolution. |
| crates/lsp/src/servers/typescript_language_server.rs | Adds npm --prefix install behavior and introduces TypeScript LSP smoke tests. |
| crates/lsp/src/model.rs | Stores optional typed startup failure reason in LspState::Failed. |
| crates/lsp/Cargo.toml | Adds rustls dependency (currently for tests). |
| Cargo.lock | Updates lockfile for dependency graph changes. |
| app/src/settings_view/code_page.rs | Switches repairability detection from string parsing to typed failure reason. |
| app/src/code/footer.rs | Updates pattern matches for expanded Failed state. |
Comments suppressed due to low confidence (1)
crates/lsp/Cargo.toml:35
rustlsis only referenced from the#[cfg(all(test, feature = "local_fs"))]smoke tests intypescript_language_server.rs. Keeping it in[dependencies]makes it part of normal builds unnecessarily; move it to[dev-dependencies](or gate it behind a test-only dependency) to avoid extra compile time and dependency surface for production builds.
node_runtime = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
rustls = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
warp_core = { workspace = true }
warp_util.workspace = true
💡 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>
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.
Description
MissingBinary { server_type }reason instead of detecting repairability from error textInstall/repairaffordance tied to that typed startup reason--prefixso repair installs land in CastCodes' managed language-server directoryTesting
cargo test -p lsp supported_servers --features local_fsPATH="/Users/buns/.cargo/bin:/Users/buns/.nvm/versions/node/v24.13.0/bin:/usr/bin:/bin" CASTCODES_TS_LSP_SMOKE_REPO=/tmp/castcodes-ts-lsp-smoke/workspace-local cargo test -p lsp smoke_workspace_local_typescript_lsp_from_env --features local_fs -- --nocaptureHOME=/tmp/castcodes-ts-lsp-smoke/home CARGO_HOME=/Users/buns/.cargo RUSTUP_HOME=/Users/buns/.rustup PATH="/Users/buns/.cargo/bin:/Users/buns/.nvm/versions/node/v24.13.0/bin:/usr/bin:/bin" CAST_CODES_DATA_PROFILE=ts-lsp-smoke-pr57 CASTCODES_TS_LSP_MISSING_REPO=/tmp/castcodes-ts-lsp-smoke/missing-binary cargo test -p lsp smoke_managed_typescript_lsp_install_from_env --features local_fs -- --nocapturecargo check -p warp-app --bin cast-codes --features gui,cast-agentCHANGELOG-BUG-FIX: TypeScript/JavaScript indexing no longer requires a global
typescript-language-server; use Settings > Codebase Indexing > Install/repair, or install locally withnpm install -D typescript typescript-language-server.