-
Notifications
You must be signed in to change notification settings - Fork 30.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 Import not working (Typescript ) after latest update #132299
Comments
Similar issue for me, except it's an issue where in my monorepo it is only suggesting imports using the package path even for files from the same package. ex. If I have two packages |
To clarify, this is new bug for this version and did not exist in the prior release, I have downgraded for now. |
@dariusj18 how did you downgrade? was it by downloading the previous version? |
@viczam yes, just downloaded the prior version and reinstalled |
Please share a minimal example project that demonstrates the issue |
@mjbvz Do you imply that it somehow functions in 1.60.0 for you? To clarify, Quick Fix import action functions on 1.60.0, it's autocomplete that does not. |
Please share a minimal example project with steps to reproduce the issue so I can test |
@mjbvz I hope this helps https://github.com/artu-ole/vscode-132299 |
Sorry @mjbvz, I really don't have time to create an example project. But hopefully this additional information helps: I'm using latest version of NextJS, with this as my tsconfig.json:
This only seems to be an issue in .tsx (React JSX) files. Regular .ts files the import statement is automatically added to the top as expected. |
Also had to downgrade VS Code, in our project, we have a Before, Auto Import used to also import from |
Same here That said, this is an example with https://github.com/chakra-ui/chakra-ui, other packages are still auto importing in 1.60.1, like https://github.com/react-hook-form/react-hook-form |
@artu-ole Works for me: Any extra steps? Have you tested on insiders with extensions disabled? @IHIutch Please share a minimal example project that demonstrates the issue. Also confirm that whatever package you are trying to import from is listed in your package.json (previously we also included imports for dependencies of dependencies, but TS 4.4 tried to cut these down) |
Here you go: https://github.com/IHIutch/auto-import-test I also made a recording: It does look like the auto import works when you're using the specific package, but in previous VSCode versions, auto importing out of This is VSCode 1.59.1: Maybe this is an issue with how components are exported in certain packages, I did comment on a discussion in So I guess Im trying to understand if this is a VSCode bug or a Chakra (and the like) bug. For full transparency, I know nothing about Typescript... |
Based on chakra-ui/chakra-ui#4608 this behaviour may not only in typescript but also happens in regular javascript. |
for me disabling lit-plugin extension and reloading vscode re enabled auto imports |
@lillallol @mjbvz |
I just wanted to add and confirm that this behavior was also happening for me for normal I can also confirm that disabling |
I'll confirm that I do not have that extension installed |
I used the excellent ”extension bisect” to determine that lit-plugin caused the issue for me. You can probably find your problematic extension the same way |
This is how I can reproduce it
With lit-plugin installed and enabled: No import is added |
No such luck for me. As I mentioned above, auto import isn't completely broken for me. It just isn't working in a specific circumstance. I'm trying to understand if this is unexpected or expected behavior given the recent VSCode update. Since I neither maintain |
@IHIutch If you have the time it might be helpful if you can try the extension bisect process @Artur- mentioned. You might be able to find another extension that's breaking it for you and maybe that will help find the core problem quicker? |
@Artur- @jjspace Please file this issue against the lit-html extension @IHIutch Please open a separate issue with a minimal repo so we can investigate separately? @Sheldonfrith Can you check if lit-html was causing this? If not, please share a minimal example with steps to reproduce so we can investigate this |
@mjbvz @Artur- already created one in the |
Is this possibly related to |
@mjbvz Yes it looks like this was caused by lit plugin for me as well. Thank you all! |
Ok, I'm going to close this issue as caused by lit plugin If you are still seeing issue with the plugin/extension disabled, please open a new issue with a minimal example project demonstrating the issue so that we can investigate |
@mjbvz lit-plugin hasn't changed in some time, so its pretty clear that whatever was published in 1.60.0 of vscode was capable of breaking extensions which worked in 1.59.x, right? if we haven't changed our extension and now it has broken, it is vscode's change, not ours. even if it turns out its some behaviour we were relying on that vsc dropped, thats a breaking change nobody announced. ill look into it but i don't think its sensible to dismiss the issue here. vscode caused this, the extension did not change. so i don't have to read through a 1,000+ file diff (1.59.x -> 1.60.x), if any maintainers/contributors have any ideas what could've changed that affects imports, please do let me know. |
@43081j This was caused by change in the internal TypeScript apis that lit-plugin extends, not by a change in VS Code itself. Try looking to see what changed with those apis in TS 4.4 |
ah awesome, thanks for pointing me in the right direction. will take a look 👍 |
Issue Type: Bug
Autocomplete imports have not worked for me since latest update. Specifically the list of suggestions that pops up when I'm typing, which normally I press "Tab" to select and automatically add the import statement at the top of the file. The suggestions are still there, but it no longer adds the import statement at the top of the file.
VS Code version: Code 1.60.0 (e7d7e9a, 2021-09-01T10:41:52.311Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (54)
(2 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: