-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
VSCode version 1.58.2 Not able to add new imports in Typescript rush monorepos #45300
Comments
(Experimental duplicate detection) |
Please share a minimal example project that demonstrates this issue |
Thanks @sgoossens Can you also try upgrading the test work workspace to use |
@mjbvz After installing the extension, Typescript was able to auto import 3rd party dependencies, however it would not install the dependencies coming from within the project. I pushed changes to the repo to reflect all the imports that could be done automatically with the extension above |
This issues seems to crop up quite a bit in the rush monorepo context. I spent a couple days investigating it with the help of some of the rush folks, and I think I have a summary of what's going on, which I'm posting here in the hope it helps others. TLDR: the issue is fixed in the current nightlies of TS and VSCode, and there is a fairly simple workaround for stable releases. There is a problem with the interaction between TS 4.3.5 (and presumably earlier versions) and PNPM workspaces. You can see it very easily in this repository which is a totally vanilla pnpm library with workspaces turned on and TS version 4.3.5 as a dep. Just do a pnpm install on the repo and then look at the test file in You can double check that autoimport does work in a vanilla npm repository by looking at the same file in this plain npm repo for the same project. (The same problem also occurs in a rush repo--e.g., this one--but that's really just because rush uses pnpm in its default configuration.) The problem goes away if you upgrade typescript to typescript@next AND use the current nightly build of VSCode. You need to do both. If you are using the current version of coc.nvim you just need to upgrade TS. So, the issue appears to be an interaction between TS, pnpm, and VSCode which is fixed in the nightly builds. I'm not sure where. If you don't want to, or can't, live on the bleeding edge, there's a fairly easy workaround--which you can see at work in the commented out line in the
That file is enough to hint to TS/VSCode where all your symlinked packages are. We are using this in a couple projects and haven't experienced any problems with this fix so far. Hope this helps. |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
command + .
to open the suggested actions)What should happen:
VSCode should suggest creating a new import statement for that interface at the top of the class file
What actually happens:
using
command + .
yields only the option toExtract to type alias
.The text was updated successfully, but these errors were encountered: