graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
15.99k stars 1.71k forks source link

Code Navigation issue when using PNPM workspaces #2344

Open tvvignesh opened 3 years ago

tvvignesh commented 3 years ago

Actual Behavior

Hi. I have my project setup as a PNPM workspace and VSCode GraphQL has been working well except for 1 issue - It navigates within node_modules folder where PNPM has symlinked the file (as part of PNPM workspaces) instead of the actual file itself. I am adding a gif below demonstrating the same:

vscode-nav-bug

If you notice, the real fragment file is within sdk/fragments but it gooes inside node_modules and gets the same file from the symlinked node_modules folder.

Expected Behavior

Code navigation navigates to the real graphql file instead.

Specifications

Version: 1.52.0-insider (user setup)
Commit: f4187f22026ff6537f2ca8132ad3209fceb5071f
Date: 2020-12-02T13:21:33.226Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.20201
acao commented 2 years ago

hmmm, will look into this, this may be baked into vscode though? or perhaps we need a path resolution to ignore symlinks somewhere

LuizAsFight commented 2 years ago

I had same problem and turns out problem wasn't with pnpm at all. Linking was all right the problem was the way vscode was interpreting it.

double-check your tsconfig.json, tsconfig.base.json. etc..

you shouldn't have "preserveSymlinks": true,

according to tsconfig

With this enabled, references to modules and packages (e.g. imports and /// directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to.