anomalyco / anomalyco/opencode
`lsp` tool returns empty results for TypeScript files in nested sub-projects (multiple tsconfig roots) under the working directory
@rekram1-node is already working on this.
Since Sep 4, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
When using the lsp tool on .ts files that belong to a nested TypeScript sub-project (a folder with its own tsconfig.json inside a larger working directory), every operation returns empty results even though a working TypeScript language server is configured. In some nested projects the tool reports No LSP server available for this file type. outright.
Environment
- opencode 1.18.27
typescript-language-server6.0.0 (global),node v24.15.0typescript@6.0.3installed locally in each sub-project
Repro layout
Working directory contains several independent TS sub-projects, each with its own tsconfig.json:
my-project/
├── frontend/tsconfig.json └── src/lib/services/query.service.ts
├── backend/tsconfig.json
├── website/tsconfig.json
├── sdk-ts/tsconfig.json
└── opencode.json (only enables cloudflare mcp)
Steps
- Open opencode with the working directory set to
my-project/(the parent that contains multiple TS sub-projects). frontend/src/lib/services/query.service.tsline 51 containsexport const queryService = { ... }.- Run the
lsptool on that file:
| Operation | Position | Result |
|---|---|---|
documentSymbol |
line 51 | No results found |
hover |
51:14 (queryService) |
[null] |
goToDefinition |
51:14 | No results found |
workspaceSymbol queryService |
— | No results found |
- Run
lsponsdk-ts/src/client.ts(a.tsfile in the sibling sub-project): returnsNo LSP server available for this file type.
Expected
documentSymbol returns the file's symbols and hover returns the type signature of queryService, as the configured TypeScript LSP is capable of producing.
Control test (works)
Calling the same typescript-language-server --stdio directly over the LSP protocol with rootUri set to the sub-project folder and waiting after textDocument/didOpen returns all symbols and the full hover for queryService (resolves to the local typescript@6.0.3). This confirms the LSP binary + config are correct and the gap is in the tool's server selection / handshake / timing.
Suspected cause
The lsp tool does not correctly associate a file with its nearest nested tsconfig.json project root. It likely (a) queries before the lazy tsserver finishes indexing the sub-project (empty results), and (b) for some sub-projects fails to select a server at all. The tool also does not seem to retry / wait for project load on subsequent warm calls.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.