Skip to content

pnpm workspace symlink path replaces source path for open files #46

Description

@hyperknot

Related Zed issue: zed-industries/zed#55792

Summary

In a pnpm monorepo, opening/saving a source file under packages/shared can cause Zed to start treating the buffer as if it lives under pnpm's node_modules/.pnpm/node_modules/... symlink path when the tsgo extension is active.

Disabling tsgo for the repo fixes the problem.

Reproduction shape

Repo structure:

pnpm-workspace.yaml
packages/shared/package.json
packages/shared/components/chat/chatcolumn/topBar/ChatSettings.tsx
tsconfig.app.json
tsconfig.node.json

packages/shared/package.json:

{
  "name": "@chatcore/shared"
}

pnpm creates this symlink:

node_modules/.pnpm/node_modules/@chatcore/shared -> ../../../../packages/shared

tsconfig.app.json and tsconfig.node.json both contain:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@shared/*": ["packages/shared/*"]
    }
  }
}

Observed behavior

I open:

packages/shared/components/chat/chatcolumn/topBar/ChatSettings.tsx

After TypeScript/tsconfig initialization, Zed starts showing/logging the same file through the pnpm symlink path:

node_modules/.pnpm/node_modules/@chatcore/shared/components/chat/chatcolumn/topBar/ChatSettings.tsx

This breaks the editor state: path changes to node_modules, diagnostics become wrong, and the file behaves as if it is no longer the workspace source file.

Relevant log details

With tsgo enabled, Zed starts:

.../extensions/work/tsgo/node_modules/@typescript/native-preview-darwin-arm64/lib/tsgo --lsp --stdio

The installed extension is:

tsgo 0.0.4
@typescript/native-preview 7.0.0-dev.20260505.1

The log first shows ESLint validating the correct URI:

file:///Users/user/Documents/dev/chatcore/chatcore/packages/shared/components/chat/chatcolumn/topBar/ChatSettings.tsx

Then after TypeScript project/watch initialization, the same file appears as:

file:///Users/user/Documents/dev/chatcore/chatcore/node_modules/.pnpm/node_modules/@chatcore/shared/components/chat/chatcolumn/topBar/ChatSettings.tsx

There were also repeated tsgo diagnostics failures in earlier logs:

Get diagnostics via tsgo failed: server shut down

and warnings such as:

skipping diagnostics update, no worktree found for path "/users/user/documents/dev/chatcore/chatcore/tsconfig.app.json"

Workaround / confirmation

Adding this repo-local Zed setting stops tsgo from being launched, and the bug disappears:

{
  "languages": {
    "JavaScript": {
      "language_servers": ["!tsgo", "..."]
    },
    "TypeScript": {
      "language_servers": ["!tsgo", "..."]
    },
    "JSX": {
      "language_servers": ["!tsgo", "..."]
    },
    "TSX": {
      "language_servers": ["!tsgo", "..."]
    }
  }
}

After restarting Zed with that setting, the log no longer starts tsgo; it starts vtsls and typescript-language-server, and all ESLint status URIs remain on the original packages/shared/... path.

Environment

Zed: v1.0.1+stable.260.ad3e097279b3a5c04b273a4f2f6c6ed1729ea0c8
OS: macOS 15.7.3
Architecture: aarch64
pnpm monorepo
tsgo extension: 0.0.4
@typescript/native-preview: 7.0.0-dev.20260505.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions