I am currently developing some JS/ES projects with vscode and a bunch of extensions. But sadly, the intellisense feature of VSCode does not work as intended.
Please see the repo https://github.com/svennergr/intellisense-test as an example setup of my project. The exact point I am talking about is the intellisense or type declaration of the "component" in Main.js. VSCode shows the type "Component" just as any:
Only when I import the Component and its typedef to the Main.js file, the intellisense definition works as intended:
But I don't want this import here, since I don't use it any further. Is there a way to configure VSCode's intellisense to also get typedefs from other project files?
Thank you in advance.
If you find IntelliSense has stopped working, the language service may not be running. Try restarting VS Code and this should solve the issue. If you are still missing IntelliSense features after installing a language extension, open an issue in the repository of the language extension.
Why is VS Code suggestions not working? If you're coding in JavaScript or TypeScript and finds that VSCode IntelliSense does work but does not behave properly, it's likely that you've selected the wrong language mode. TypeScript and JavaScript share the same language service, so you need to select the right language.
You can enable or disable particular IntelliSense features in the Options dialog box, under Text Editor > C/C++ > Advanced. To configure IntelliSense for single files that aren't part of a project, look for the IntelliSense and browsing for non-project files section.
I figured out, that there definetly needs to be any kind of import. Instead of importing the Component to the whole file, it can only be imported into the typedef like the following:
* @param {import('./Component').default} [component] The component to assign.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With