How to enable Intellisense for JavaScript in Visual Studio Code

。_饼干妹妹 提交于 2019-12-17 18:34:35

问题


I want to use VS Code to try out the examples of a JavaScript book, but there's no intellisense, or at least I don't know how to activate it.

In Visual Studio this feature works out of the box :

But in VS Code, all I got is a message saying "There's no suggestions"

What do I need to do to enable the intellisense in VSCode?

Thanks.


回答1:


Currently Unsupported

JS intellisense doesnt work in HTML script tag - VSCode GitHub Issues #4369

Smart Javascript suggestions inside HTML files no loger working after Visual Studio Code update - StackOverflow




回答2:


Starting with the November 2016 (version 1.8) release, Visual Studio Code now fully supports IntelliSense for JavaScript in HTML.

Note that the language support doesn't follow script includes, it only knows about definitions made in the same file.




回答3:


It worked for me, when the file had a .js extension. I didn't get any intellisense when I pasted it into .html file between script tags.

Edit To Add: You can also change the Language Mode by clicking 'HTML' in the bottom of the VS Code window and change it to 'JavaScript'.




回答4:


Visual Studio Code version 1.4.0 does not support CSS intelli-sense.

I have an extension for CSS style, id and class intelli-sense for html documents:

Features:

  • Style tag completion and hover.
  • Style attribute completion and hover.
  • Id attribute completion.
  • Class attribute completion.
  • Scans workspace folder for css files.
  • Supports optional resource.json file for fine tuned resource selection.

Link:

https://marketplace.visualstudio.com/items?itemName=ecmel.vscode-html-css



来源:https://stackoverflow.com/questions/37055382/how-to-enable-intellisense-for-javascript-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!