VSCode intelliSense autocomplete for javascript
Asked Answered
W

3

9

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.

Wald answered 11/6, 2015 at 23:56 Comment(1)
Possible duplicate of VS Code autocompletion base on word in fileSoutheastwardly
W
8

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.completeFunctionCalls": true,
Wald answered 11/6, 2015 at 23:56 Comment(2)
Doesn't work for me in Code 1.8.1 for macOS. Unknown configuration settingHeckle
yes they have changed it. I specify the version in the question just for this case.Wald
D
2

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

Deakin answered 5/12, 2015 at 18:55 Comment(0)
S
0

I did experience the same problem. I updated my node and npm to the latest version and then initialized the npm project through npm init.

After this, I ran the following command:

npm install --save-dev @types/node

With this, you should have the package installed in the node_modules folder as a dependency.

The above steps did solve my problem. Make sure that you can see the installed npm package as a dependency.

Refer to this ans for a more detailed explanation.

Sharolynsharon answered 31/1 at 5:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.