cbdeveloper
cbdeveloper

Reputation: 31325

VSCode Intellisense weird autocompletion on Javascript code

I just ran into some strange behavior using VSCode writing a JS file.

See that I'm trying to access the hasOwnProperty() method on the fluffy object. And VSCode didn't autocomplete or suggest anything on my line of code.

At this point I'm already thinking that I'm doing something wrong and that I'm probably not able to access this method through my object.

But the interesting thing is:

enter image description here

QUESTION:

As soon as a finish typing hasOwnProperty and I open the parenthesis, VSCode triggers the IntelliSense and recognizes the method. Is it normal? How come VSCode doesn't show me all the properties and methods available to my object since the first letter that I've typed?

Thanks in advance for your help.

VSCode About: Version: 1.25.1 Date: 2018-07-11T15:43:53.668Z Electron: 1.7.12 Chrome: 58.0.3029.110 Node.js: 7.9.0 V8: 5.8.283.38 Architecture: x64

Upvotes: 2

Views: 1826

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65175

Yes this is expected. We don't show intellisense suggestions for Object.prototype properties because they would show up on pretty much every object and are therefore not very useful. However the language smarts do know that hasOwnProperty exists, which is why you get signature help for it

Upvotes: 1

Related Questions