Skip to content

Harden TypeScript LSP startup repair state#60

Merged
BunsDev merged 3 commits into
mainfrom
harden/typescript-lsp-startup-reason
May 18, 2026
Merged

Harden TypeScript LSP startup repair state#60
BunsDev merged 3 commits into
mainfrom
harden/typescript-lsp-startup-reason

Conversation

@BunsDev

@BunsDev BunsDev commented May 18, 2026

Copy link
Copy Markdown
Member

Description

  • carries TypeScript LSP missing-binary startup failures as a typed MissingBinary { server_type } reason instead of detecting repairability from error text
  • keeps the Codebase Indexing Install/repair affordance tied to that typed startup reason
  • pins managed TypeScript LSP npm installs with --prefix so repair installs land in CastCodes' managed language-server directory

Testing

  • cargo test -p lsp supported_servers --features local_fs
  • PATH="/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 -- --nocapture
  • HOME=/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 -- --nocapture
  • cargo check -p warp-app --bin cast-codes --features gui,cast-agent

CHANGELOG-BUG-FIX: TypeScript/JavaScript indexing no longer requires a global typescript-language-server; use Settings > Codebase Indexing > Install/repair, or install locally with npm install -D typescript typescript-language-server.

Copilot AI review requested due to automatic review settings May 18, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 through LspState::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

  • rustls is only referenced from the #[cfg(all(test, feature = "local_fs"))] smoke tests in typescript_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.

Comment thread crates/lsp/src/servers/typescript_language_server.rs Outdated
Comment thread crates/lsp/src/servers/typescript_language_server.rs Outdated
BunsDev and others added 2 commits May 18, 2026 07:01
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>
@BunsDev BunsDev self-assigned this May 18, 2026
@BunsDev
BunsDev merged commit 36c663b into main May 18, 2026
8 checks passed
@BunsDev
BunsDev deleted the harden/typescript-lsp-startup-reason branch May 30, 2026 17:53
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.

2 participants