I have gone through the following threads before posting this question.
Visual Studio Code: Intellisense not working
Visual Studio Code Intellisense not working for Javascript
I have Visual Studio version 1.26.1 on my Windows 10 laptop.
I am learning Node.Js, so I wanted to learn various functionalities in 'FS' module. I created a new file called 'app1.js' in Visual Studio Code, and wrote the following line of code.
fsObj = require('fs');
After this when I typed fsObj. to see what functions/properties are available under the fs object, I get a list with only two objects, which are not elements of the 'fs' module. I do not understand why IntelliSense is not showing the elemetns of 'fs' module. I am pasting a screen shot of the VS Code screen.
Without const
, let
or var
before your variable fsObj
, that variable has a 'global' scope. Something about that seems to prevent vscode from being able to assign the proper intellisense parameters to that variable. Adding one of those, like const
, provides a different scope where the intellisense works. I cannot explain exactly what is preventing intellisense, perhaps the variable is bound to something higher in the scope chain that prevents it working.
In any case, failing to include const/let/var
would result in an error if strict mode was used.
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