Skip to content

Add TypeScript server runtime controls - #63

Open
kjanat wants to merge 4 commits into
zed-extensions:mainfrom
kjanat:feature/typescript-runtime-controls
Open

Add TypeScript server runtime controls#63
kjanat wants to merge 4 commits into
zed-extensions:mainfrom
kjanat:feature/typescript-runtime-controls

Conversation

@kjanat

@kjanat kjanat commented Jul 17, 2026

Copy link
Copy Markdown

Note

Stack 3 of 4. Depends on #62, which depends on #61.

Until the lower layers merge, GitHub includes them in this PR's aggregate diff. The incremental change for this layer is commit 307be82.

Summary

  • Support custom lsp.typescript-ls.binary.path, arguments, and environment variables.
  • Treat configured tsc, tsc.js, and tsc.exe paths as direct server launchers.
  • Treat other configured binary paths as custom Node executables and pass the resolved TypeScript bin/tsc launcher.
  • Add server.pprofDir, server.args, and server.env launch controls.
  • Add validated server.goMemLimit support through the Go runtime's GOMEMLIMIT environment variable.
  • Merge the worktree shell environment and configured environment sources with documented precedence.

Motivation

TypeScript's native server exposes useful runtime diagnostics and Go memory controls, while advanced installations need explicit command, argument, and environment overrides. These options make those capabilities available without requiring extension releases for every new server flag.

Environment precedence

From lowest to highest:

  1. Worktree shell environment
  2. server.env
  3. server.goMemLimit
  4. binary.env

Explicit binary.arguments replace extension-generated arguments. Otherwise the extension supplies --lsp --stdio plus configured runtime arguments.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo test --locked --all-targets (14 tests)
  • markdownlint-cli2 README.md
  • tombi lint extension.toml Cargo.toml
  • git diff --check

@kjanat

This comment was marked as outdated.

@kjanat kjanat closed this Jul 17, 2026
@kjanat

kjanat commented Jul 17, 2026

Copy link
Copy Markdown
Author

Re-opening.. Codex decided properly stacking was impossible so closing was a better direction... My bad...

@kjanat kjanat reopened this Jul 17, 2026
@spotdemo4

Copy link
Copy Markdown

Would it be possible to add automatic PATH lookup to this (like #45)?

My use case is a Nix dev shell, loaded through direnv, which provides TypeScript 7 through typescript-go. Both tsc and tsgo are available on the worktree's PATH, but the current extension does not call worktree.which(...) and therefore downloads another TypeScript installation.

@kjanat

kjanat commented Jul 29, 2026

Copy link
Copy Markdown
Author

Added in kjanat/zed-tsgo@8c6f34b. The resolution order is now:

  1. lsp.typescript-ls.binary.path
  2. tsdk.path
  3. TypeScript 7 dependency in the root package.json
  4. tsc on the worktree PATH, probed with --version and used only when it reports TypeScript 7+
  5. Managed typescript install

The PATH step resolves through Zed's worktree shell environment, so a direnv-loaded Nix shell is covered, and the executable is launched directly as tsc --lsp --stdio rather than through Node like #45. A tsc older than 7 fails the probe and resolution falls through.

A project-local install still wins over PATH, so a pinned package.json dependency isn't shadowed by an ambient binary. binary.path overrides everything if you want the Nix tsc to beat a local package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants