-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto imports are broken with yarn PNP on Windows #39331
Comments
So I renamed this when I accidentally typed a NodeJS package name and realized it supports those auto-imports, but not my dependencies. Given I'm using Yarn 2 which is defacto PnP'd now, I'll assume this is relevant to that. I recall the newest Code update fixed the issue with However, it looks like auto-imports are broken in PnP projects. |
Possible duplicate of #28289 |
@TheGrimSilence can you grab the TS Server log generated during that action? Also, can you try this with the JS/TS Nightly extension if you haven’t already? |
Looks like it's trying to look for "@vsintellicode/typescript-intellicode-plugin" but can't find it. So this stems from Yarn 2's patch not including it. I tried |
Using the Nightly wouldn't work since Yarn 2 uses Plug'n'Play and a virtual filesystem which uses a custom version of the latest TypeScript release. Effectively pointless in this scenario unfortunately. |
Would you be able to provide either an example repo or step-by-step instructions on how to create a simple reproduction of the problem? Where does that version of TypeScript live? In order for VS Code to use it, you’d have to point to it in |
https://github.com/thegrimsilence/yarnberry-toolkit uses Yarn 2's Zero-Install so cloning that will give you a direct state of my own local repo since I commit frequently. And yeah Yarn 2 has you install |
Got it, it's an issue with the Visual Studio Intellicode Extension, but disabling it does nothing except removing the error from the server log. Reloaded the workspace and it still has auto-import problems. |
Running with extensions disabled did nothing to help. I'm really not sure what it could be at this point. |
I'll try to give a try on Windows to see if that makes a difference. |
If it's windows I'm throwing my surface book out the window 😂 |
For the brief time that I had a Surface Book, I was frequently concerned for the safety of pedestrians walking underneath my office window 🙊 |
Yeah it's a nice-to-have but development has been horrible. WSL 2 makes things... okay, but I just wish Microsoft made a variant of Windows that ran exclusively on Linux since I can't afford a mac |
For whatever reason, this has to be related to Windows. I fresh installed VS Code, no custom settings, no extensions, still the same problem. A headache is what it is |
Yep, it repros for me on Windows. Thanks for the help! |
Thank you. I was worried I'd have to give up my career goals if it was a local issue I was overlooking 😂😂 |
By the way, @andrewbranch what software did you use to capture and save as a Gif? cause currently I have to use Xbox Game Bar to capture and then save it as a horribly compressed gif which as you saw was really small even though I have a 4K screen. |
I use https://getkap.co, which is macOS-only unfortunately. Ok, so I’ve tracked this down to be the fault of yarn’s wrapper around TypeScript. It’s intercepting messages to TS Server, deserializing them, looking for file paths, modifying those paths before passing them on. Unfortunately, it seems to be doing this incorrectly on Windows, at least some of the time. First, when we send back the full list of completions, the {
"name": "Configuration",
"kind": "interface",
"kindModifiers": "declare",
"sortText": "5",
"hasAction": true,
"source": "c:/Users/andrew/yarnberry-toolkit/.yarn/cache/@types-webpack-npm-4.41.18-f868232c99-43fefaccab.zip/node_modules/@types/webpack/index"
} The TS Server wrapper sees the path with {
"name": "Configuration",
"kind": "interface",
"kindModifiers": "declare",
"sortText": "5",
"hasAction": true,
"source": "zip:/c:/Users/andrew/yarnberry-toolkit/.yarn/cache/@types-webpack-npm-4.41.18-f868232c99-43fefaccab.zip/node_modules/@types/webpack/index"
} Now, when you highlight that item in VS Code, we make another request to get the details for that completion item. That request includes the {
"seq": 53,
"type": "request",
"command": "completionEntryDetails",
"arguments": {
"file": "c:/Users/andrew/yarnberry-toolkit/src/tools/BaseCommand.ts",
"line": 4,
"offset": 18,
"entryNames": [
{
"name": "Configuration",
"source": "zip:/c:/Users/andrew/yarnberry-toolkit/.yarn/cache/@types-webpack-npm-4.41.18-f868232c99-43fefaccab.zip/node_modules/@types/webpack/index"
}
]
}
} However, before sending it on to TS Server proper, the wrapper notices the {
"seq": 53,
"type": "request",
"command": "completionEntryDetails",
"arguments": {
"file": "c:/Users/andrew/yarnberry-toolkit/src/tools/BaseCommand.ts",
"line": 4,
"offset": 18,
"entryNames": [
{
"name": "Configuration",
"source": "/c:/Users/andrew/yarnberry-toolkit/.yarn/cache/@types-webpack-npm-4.41.18-f868232c99-43fefaccab.zip/node_modules/@types/webpack/index"
}
]
}
} Uh oh! Now we’ve wound up with a superfluous leading slash on that So yep, this is a yarn bug. |
Thank you for your help! I'll take this over to yarnpkg/berry and let them know the details so they can fix it. |
Thanks for investigating! This is now fixed in yarnpkg/berry#1534 |
Issue Type: Bug
I haven't changed my settings at all, but after upgrading to the newest patch my imports and suggestions no longer show which package the import recommendation is coming from. Say I have 2
Configuration
s and I want to auto-import the one fromwebpack
, it should say which package the current suggestion comes from, and when hittingENTER
it doesn't import, but rather just finishes the line.VS Code version: Code 1.46.1 (cd9ea6488829f560dc949a8b2fb789f3cdc05f5d, 2020-06-17T21:13:20.174Z)
OS version: Windows_NT x64 10.0.18363
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Extensions (30)
(1 theme extensions excluded)
The text was updated successfully, but these errors were encountered: