Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
TypeScript monorepos currently do not activate the TypeScript LSP.
Currently, OpenCode uses
opencode/packages/opencode/src/lsp/server.ts
Lines 92 to 119 in 6c7d968
| export const Typescript: Info = { | |
| id: "typescript", | |
| root: NearestRoot( | |
| ["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"], | |
| ["deno.json", "deno.jsonc"], | |
| ), | |
| extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"], | |
| async spawn(root) { | |
| const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {}) | |
| log.info("typescript server", { tsserver }) | |
| if (!tsserver) return | |
| const proc = spawn(BunProc.which(), ["x", "typescript-language-server", "--stdio"], { | |
| cwd: root, | |
| env: { | |
| ...process.env, | |
| BUN_BE_BUN: "1", | |
| }, | |
| }) | |
| return { | |
| process: proc, | |
| initialization: { | |
| tsserver: { | |
| path: tsserver, | |
| }, | |
| }, | |
| } | |
| }, | |
| } |
In a monorepo where the TypeScript workspace lives one level lower, TypeScript LSP does not activate. It is common to be running OpenCode sessions in the root, so that the agent will access the different workspace members.
Example Scenario
In my case, the repository root is a pnpm workspace, but the TypeScript projects live in child packages rather than at the repo root.
Workspace layout:
/
├── package.json
├── pnpm-workspace.yaml
├── node_modules
│ └── .pnpm
│ └── [email protected]
│ └── node_modules
│ └── typescript
├── client
│ ├── package.json
│ ├── tsconfig.json
│ └── node_modules
│ ├── typescript -> ../../node_modules/.pnpm/[email protected]/node_modules/typescript
│ └── .bin
│ └── tsc
└── server
├── package.json
├── tsconfig.json
└── node_modules
├── typescript -> ../../node_modules/.pnpm/[email protected]/node_modules/typescript
└── .bin
└── tsc
pnpm-workspace.yaml:
packages:
- "client"
- "server"While repo root has a package.json and a node_modules/, there is no dependencies in the package.json (and hence does not have a node_modules/typescript).
Observed package setup:
client/package.jsonhastypescriptindevDependenciesserver/package.jsonhastypescriptindevDependenciesclient/tsconfig.jsonexistsserver/tsconfig.jsonexists
Actual symlink resolution in this repo:
client/node_modules/typescript -> ../../node_modules/.pnpm/[email protected]/node_modules/typescript
server/node_modules/typescript -> ../../node_modules/.pnpm/[email protected]/node_modules/typescript
If possible, OpenCode should somehow support the TypeScript LSP. For example, reading any file that is part of the pnpm workspace, which has a TypeScript dependency in that project, could trigger the LSP activation for that file.
References
See #8712 which briefly describes the scenario in which OpenCode fails to run the TypeScript LSP
Activity
github-actions commentedon Mar 6, 2026
This issue might be a duplicate of existing issues. Please check:
In fact, this issue already references #8712 in its description. Consider whether your request can be addressed by or combined with that existing issue.
OverHash commentedon Mar 6, 2026
This feature is related, but not the same as that issue. This issue is not focused around forcing LSP usage, it is more general and would like automatic LSP detection and activation (which is much more convenient than forcing LSP usage).
OverHash commentedon Mar 6, 2026
Ugh, looks like this is a duplicate of #7690.. I did look :(