language-tools: Yarn 3 incompatibility
Thank you for the awesome extension! I loved using it with takeover mode, but it seems completely broken as of moving off to Yarn 3 without the node_modules folder.
First of all, it doesn’t seem to work with Yarn 3 relative path workspaces. If I have my dependency like
"gun": "workspace:packages/gun",
I can’t refer to it like
import Gun from 'gun';
And get to refer to it like
import Gun from '@/../../gun';
instead.
Even though without Volar, Yarn 3 workspaces are perfectly handled.
If I disable Take Over Mode, Vue TS checks fail completely:
Then, VSCode shows two tooltips rather than one:
If Volar has any issues that VSCode has not, these messages differ:
The upper one finds the module, the lower one (Volar) does not.
Last, but not least – Volar doesn’t import packages from .yarn:
Is Yarn 3 support not intended? I really wish it was working. Hope it’s not much of a headache to fix this. Thank you in advance!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
This works for me:
I am still unable to get the “Go To Definition” feature of VS Code to work when using Yarn PnP and Volar.
There has been an issue open with Yarn for several years without fix. Is this something that could be fixed from Volar side instead?
@adalinesimonian The error I get in that repo is
If I then set the
moduleResolution
tonode
it works.@johnsoncodehk
typescript.tsdk
is set by Yarn so Volar just needs to be told to use the workspace version. https://yarnpkg.com/getting-started/editor-sdks/#vscode If the workspace is trusted andtypescript.tsdk
is set Volar could probably pick the workspace version automatically.@Lexpeartha it recognizes it.
here’s a reproduction repository: https://github.com/adalinesimonian/volar-pnp-test
i’ve tested this in a workspace and without and it happens either which way.
testing further, the language server does receive the correct workspace configuration which includes the path to the typescript pnp sdk:
does volar respect the typescript location in vscode settings?
@Orimay I was able to create a simple project that uses yarn pnp and workspaces. Made a couple of dumb mistakes along the way, but ended up with a sanity verifying checklist which might be helpful:
"gun": "workspace:*"
notation instead of the experimental relative path one ("gun": "workspace:packages/gun"
)?