Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellisense not working on multiple files

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:

Component as any

Only when I import the Component and its typedef to the Main.js file, the intellisense definition works as intended:

Component with def

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.

like image 330
svennergr Avatar asked Apr 03 '19 09:04

svennergr


People also ask

Why is my IntelliSense not working?

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 Autocomplete is not working in VS Code?

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.

How do I enable IntelliSense?

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.


1 Answers

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.
like image 85
svennergr Avatar answered Oct 19 '22 05:10

svennergr