-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
VS Code React Typescript component auto-import and autocomplete not working. #45004
Comments
When you’re inside the Kapture.2021-07-13.at.11.19.12.mp4 |
Thank you for the explanation.
…On Tue, Jul 13, 2021, 20:21 Andrew Branch ***@***.***> wrote:
When you’re inside the <div></div>, you’re typing plain old JSX text. We
don’t offer any kind of completions or auto imports there because it’s
basically the same thing as writing inside a string literal. Think about
how annoying it would be if you were *actually* just trying to type the
word “Sidebar” as part of some paragraph text and you kept auto-importing
things as you typed. You have to type a < if you want completions for
tag/component names.
https://user-images.githubusercontent.com/3277153/125504694-efd98ca3-4e59-4e38-ba57-e7d40bcbee6e.mp4
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45004 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACB6HALKKZ57QG4OOUKXRTLTXR7ZPANCNFSM5AIRQJUA>
.
|
Maybe this is also working as intended, but I'll ask anyway. The method where you type Is the only option to get autocomplete from npm modules to include each folder separately, like so?: "include": [
"src/**/*",
"src/**/*.d.tsx",
"src/**/*.tsx",
"node_modules/primereact/*"
] |
You shouldn’t have to do anything special to get auto imports from node_modules, but some libraries unknowingly use patterns that make it impossible for auto-imports to discover what’s available. Can you tell me what component you’re trying to import from what library? |
All components from primereact exhibit this behaviour.
…On Wed, Jul 14, 2021, 19:14 Andrew Branch ***@***.***> wrote:
You shouldn’t have to do anything special to get auto imports from
node_modules, but some libraries unknowingly use patterns that make it
impossible for auto-imports to discover what’s available. Can you tell me
what component you’re trying to import from what library?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45004 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACB6HAPU6GJRBEB7DQRIWNDTXXAW5ANCNFSM5AIRQJUA>
.
|
|
Bug Report
🔎 Search Terms
vscode tsx autocomplete, vscode tsx auto import, vscode typescript react autocomplete
🕗 Version & Regression Information
I'm on Typescript version 4.3.5 and I have tried the nightly build too.
I'm on the latest VS Code version 1.58.0. It is a new install with all extensions disabled.
Doesn't work on either 1.56 or 1.57 too.
This seems to be a duplicate of #44657 but that issue is marked as closed even if it still persists.
💻 Code
Analytics.tsx
Sidebar.tsx
Folder structure:

package.json
tsconfig.json
🙁 Actual behavior
I try to start typing the "Sidebar" component and the autocomplete doesn't suggest it anywhere. When I finish typing the component, the autoimport function shows up in the quick fix category.

🙂 Expected behavior
It should have suggested the "Sidebar" component and upon clicking enter, it should have imported it automatically.
The text was updated successfully, but these errors were encountered: