Skip to content

workspace/symbol returns results from projects outside the workspace folder #4802

Description

@stewartmcgown

Extension Version

0.20260731.1

VS Code Version

Cursor 3.13.25 (VS Code 1.128.0) — also reproduces the LSP workspace/symbol behavior via TypeScript Native Preview / tsgo

Operating system Version

macOS 26.6 (darwin arm64)

Steps to reproduce

  1. Enable TypeScript Native Preview (js/ts.experimental.useTsgo: true).
  2. Open a single-folder workspace, e.g. /path/to/repo (not multi-root).
  3. At some point open (or have the editor restore) TypeScript files from a sibling folder / git worktree of the same repo, e.g. /path/to/repo-other-worktree/..., or from an unrelated repo. Those documents may not remain as visible tabs — only one in-workspace file (or none) may be shown.
  4. Invoke Go to Symbol in Workspace (workspace/symbol).

Observed in Native Preview logs:

  • handled method 'workspace/symbol'
  • Prior DidOpenFile / Creating ConfiguredProject entries for paths outside the workspace folder
  • Symbol results include duplicates from those out-of-folder projects

Example from a session where the UI showed a single file under the workspace root, while the language server still had dozens of out-of-folder documents open (sibling git worktrees + other repos) and returned their symbols.

Issue

Expected: workspace/symbol should prefer or be limited to projects under the workspace folder(s) provided to the language server. Opening (or silently restoring) a file outside the folder for a one-off look should not permanently pollute Go to Symbol in Workspace with every symbol from that external project tree.

Actual: tsgo loads configured projects for every opened document, including those outside the workspace folder, and workspace/symbol searches all loaded projects. With a large monorepo + many git worktrees, this yields:

  • Duplicate / confusing symbol hits from other worktrees
  • Very slow symbol queries (multi-second to ~20s observed)
  • High memory use when many external projects stay loaded (typescript.native-preview.goMemLimit set high makes this worse)

There does not appear to be a setting to scope workspace/symbol to workspace folders only.

Ask: Scope workspace/symbol to workspace folders by default (or add a preference), and/or unload / exclude configured projects whose roots lie outside the workspace folders once those documents are no longer open — especially when the client only has a single workspace folder.

Related context (not duplicates, but nearby):

Happy to provide redacted Native Preview logs showing DidOpenFile / Creating ConfiguredProject for out-of-folder roots alongside workspace/symbol timings if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions