question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] PnPify in Visual Studio Code does not support "Go to Definition"

See original GitHub issue
  • I’d be willing to implement a fix

Describe the bug

When using the PnPify workflow in Visual Studio Code, attempting to “Go to Definition” of a dependency results in VS Code attempting, and failing, to open a source file from inside a zipped package in the cache:

Unable to open 'index.d.ts': Unable to read file (Error: File not found (c:\Users\dallo\devroot\tmp\my-app\.yarn\cache\@types-react-npm-16.9.19-21809ae185-1.zip\node_modules\@types\react\index.d.ts)).

To Reproduce

(This isn’t exactly minimal since I don’t think Create React App is part of the issue, but it’s at least very simple to reproduce, and I don’t have time to figure out how to create a project without a template right now. Would appreciate anyone with more context helping break it down a little more)

  1. Create an app with Create React App as described in the CRA docs:
npx create-react-app my-app --template typescript
  1. Follow the instructions to enable PnPify in Visual Studio Code: https://yarnpkg.com/advanced/editor-sdks#vscode
  2. In App.tsx, try to “Go to Definition” on the React package.

Screenshots

image

Environment if relevant (please complete the following information):

  • OS: Windows 10, build 18362.592
  • Node v13.7.0
  • Yarn v2.0.0-rc.27

Additional context

Looks like the root of the issue is that it’s trying to go inside a zip file.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
skeatecommented, Jan 28, 2020

Thanks for that link, though it’s a little hard to understand without an example given. But I don’t want to derail this issue with a tangent.

Do you agree that it’s an issue, or should editors be able to access $$virtual somehow?

Also, aside for anyone else finding this thread who wants a fix now: yarn unplug <pkg>

4reactions
arcaniscommented, Jan 30, 2020

Do you agree that it’s an issue, or should editors be able to access $$virtual somehow?

It’s an issue in that I don’t expect editors to support the $$virtual file pattern as their encoding is a bit of a Yarn implementation detail, but I can’t find any better tool we can use at the moment.

Closing this issue as there’s nothing actionable on our side at the moment (for people reaching this, please upvote https://github.com/microsoft/vscode/issues/75559 to show your interest to the VSCode team).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure VSCode to run Yarn 2 (with PnP) powered ...
I had this problem last night while migrating to Yarn v2 and using PnP. Make sure that after running yarn dlx @yarnpkg/sdks vscode...
Read more >
Code Navigation in Visual Studio Code
If a language supports it, you can go to the definition of a symbol by pressing F12. If you press Ctrl and hover...
Read more >
Go with Visual Studio Code
Using the Go extension for Visual Studio Code, you get features like IntelliSense, code navigation, symbol search, testing, debugging, and many more that...
Read more >
Language Support in Visual Studio Code
Now you know that VS Code has support for the languages you care about. Read on... Code Navigation - Peek and Go to...
Read more >
Visual Studio Code Frequently Asked Questions
If you do not want to get automatic updates, you can set the Update: Mode setting from default to none . To modify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found