Home > OS >  VSCode javascript suggestions doesent show up truly?
VSCode javascript suggestions doesent show up truly?

Time:02-16

Pic1

Pic2

Pic3

Hi, I'am new at js. I'am using VSCode. My problem is suggestions. I dont know it's true name maybe not suggestions maybe it's intellisense but When I pick an element with DOM and want to change it's style component, I wrote element.style but there aren't any suggestions showing up you can see in first two pics. But if I write element.style. there are some suggestion showing up. While on chrome dev console if I write elemnt.style pic4 It shows me the style component. So how can I active it suggestions on visual studio code , like google console? I have some extensions is that cause problems? extensions

CodePudding user response:

VSCode is using static code analysis to try and guess what the types of your variables are. It has to do this because JavaScript is dynamically typed, so there is no way to be certain of the type of any given variable while you're writing the code. The JavaScript plugin for VSCode uses various heuristics to try and prove useful feedback.

Chrome actually evaluates the expressions you're typing as you type them, against a real DOM and JS runtime, and provides accurate feedback by reflecting on the value of each expression.

You can't make VSCode's static analysis behave like Chrome's dynamic reflection. They are very different systems, and this is a fundamental limitation of code-completion/intellisense for dynamic languages.

  • Related