Reputation: 193
I am working in a JS project and having difficulties with using the Auto Import feature. The function that I want to have automatically imported is located at "../utils/htmlDOMFuncs" and is named setSelectedVisit. If I start typing the name of the function, I don't get any kind of autocomplete. If I then open another file in my project that does already have something imported from "../utils/htmlDOMFuncs", then I do see the function name in my autocomplete suggestions. However, upon first hitting tab, the function is not added as an import to the top of the current file. If I then hit backspace and re-type the rest of the function name, I do then see the additional tooltip showing information about the function and where it will be auto imported from. Is this the correct behavior?
A few images to illustrate.
- Typing into file, no other files opened
- With another file opened that already imports the module
- After having used the autocomplete, then deleting and re-typing, I see the Auto Import
Upvotes: 0
Views: 1116
Reputation: 65433
You likely need to create a jsconfig.json
file at the root of your workspace with the contents:
{
"compilerOptions": {
"target": "ES6"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
This file tells VS Code to treat all js files in your workspace as part of the same project
Upvotes: 4