When creating a JS object and defining some accessors, I found that I couldn't get the intellisense after this.
Example code :
function Obj(foo) {
this.foo = foo;
}
Obj.prototype = {
get bar() {
return this.// No intellisense here
},
set bar(val) {
this.foo = val
}
};
But creating a method with Obj.prototype.test = function () {...}
will get me the intellisense.
Is there any way to replicate the same lexical analysis for this case with the user settings, or is it an actual flaw / bug ?
Edit: here is an image of what VSCode shows :
As you can see, it only shows previously used words, and nothing else.
Edit (03/04/2019): After trying again today, with v1.32.2, I noticed VSCode is able to suggest the bar
property, but still not foo
. So something was improved, but my issue not solved.
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.) in JavaScript).
If the IntelliSense is installed and still not working then most of the time restarting/reloading the program will solve the issue. So give it a try. Step 1: To restart VS Code open VS Code and press Ctrl + Shift + P keys together to open the command palette and type Reload Window in the search.
1) Take VSCode 2) Right click on the file in left pane 3) Click "Reveal in explorer" from context menu 4) Right click on the file -> Select "Open with" -> Select "Choose another program" 5) Check box "Always use this app to open . js file" 6) Click "More apps" -> "Look for another app in PC" 7) Navigate to node.
Microsoft recommends restarting VS to see if it helps. Or you could be missing type declarations if this happens with other libraries besides objects.
There's a link here that has some troubleshooting tips that you can follow.
There's a more specific link here that deals with JavaScript in Code.
Also, Code might not show it because there already is something showing up related to it. It sees that it already showed foo
. Try renaming it and see if that helps
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