VSCode intelliSense autocomplete for javascript

2019-01-28 10:13发布

I would like Visual Studio Code to autocomplete all words within the open document instead of the just the scope specific variables it finds. What should I change in the settings?

edit: code version 0.3.0 at time of question.

2条回答
该账号已被封号
2楼-- · 2019-01-28 10:33

Even though it has been quite some time for this question, I thought I might be of help to anyone else who bumbles across the same question.

So here goes . And this is for the latest version of VS Code as of writing.

For a true intellisense, i.e. for example you intend to get all the methods related to "console" as soon as you press '.' , you can use the respective Typescript definition file. Now I agree that this fix is targeted at node,and needs the same along with npm on your system. But still, works for all Major JavaScript work you might run across.

on Linux, for this, you'd need "npm" and install TypeScript Definition Manager (tsd) globally.

npm install -g tsd

then within your current project directory (or by changing to the project directory) , open a terminal window and add the following lines

tsd query node --action install
tsd query express --action install

then, as soon as you'll open your .js file in the current directory, you'll get proper autocomplete / intellisense for all DOM object and other possible stuff.

It worked for me, and this is the only reason I use VSCode on linux (for JavaScript at least, even though I like LightTable too)

for further information (and clarifications if I somehow couldnt manage to be clear enough) visit the following link:

Node.js applications on VS Code

查看更多
别忘想泡老子
3楼-- · 2019-01-28 10:37

I just figured it out. This will use all words on the page for auto complete.

// Always include all words from the current document.
"javascript.suggest.alwaysAllWords": true,

// Complete functions with their parameter signature.
"javascript.suggest.useCodeSnippetsOnMethodSuggest": true
查看更多
登录 后发表回答