Visual Studio Code autocomplete/IntelliSense not working properly for JavaScript
Asked Answered
E

3

5

Image of vscode autocomplete
It's not displaying the properties of an array like length etc.

I'm not sure if this is a problem or this is expected behavior of VScode's autocomplete/IntelliSense.

Do I need to install any extensions to make it work?

Edit:
On adding var or let before arr the autocomplete works fine normally but inside a function it doesn't work.
autocomplete inside a function

Eared answered 7/12, 2020 at 13:53 Comment(0)
R
25

Check if the building extension TypeScript and JavaScript Language Features is enabled.

To check this, go to Extensions and search for @builtin TypeScript and JavaScript Language Features.

This should look something like this: [![vscode][1]][1]

Edit:

Also, check if you choosed the right language?

  • -> CTRL (or CMD) + P
  • -> > Change Language Mode
  • -> JavaScript

Another thing I noticed: You have no var, let or const before the variable, see https://mcmap.net/q/1920476/-visual-studio-code-intellisense-not-working-for-node-js

Edit 2:

IntelliSense does not know what types the parameters have for functions. But you can use the @param annotation in the comment:

/**
 * 
 * @param {Array} arr 
 */
function a(arr) {
    arr.
}

img

For variables you can also use @type:

/** @type {Array} */
let a;

img

Radioelement answered 7/12, 2020 at 14:0 Comment(9)
Yes @Radioelement this is enabled but still not working.Eared
@at-in Choosed the right language? CTRL (or CMD) + P -> > Change Language Mode -> JavaScriptRadioelement
@at-in Another thing I noticed: You have no var, let or const before the variable, see https://mcmap.net/q/1920476/-visual-studio-code-intellisense-not-working-for-node-jsRadioelement
on adding let or var it works fine but inside a function it doesn't work. I'll edit my question a bit to explain thisEared
Just a suggestion @Daniel, you should add the let/var thing in your answer since this is also a problem someone else might face.Eared
What was the answer? I get the same issue. When I jump inside a function or method, the auto-completion won't be enabled.Penates
Thanks man, big help was actually going crazy trying to fix this.Costotomy
off topic: which font is that (Vscode)? @RadioelementTichonn
@Tichonn I think I used Fira Code in the screenshotsRadioelement
S
5

Go to Extensions and search for @builtin TypeScript and JavaScript Language Features. Try stopping and restarting this plugin and restart VS Code. Looks like a bug. This fixed it for me.

Stoplight answered 30/1, 2022 at 4:16 Comment(0)
N
0

For me I just stop the TypeScript and JavaScript Language Features extension, and it works fine, maybe a bug or a conflict with other extensions I think

Novah answered 8/4, 2022 at 3:19 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Rouble

© 2022 - 2024 — McMap. All rights reserved.