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

3 Answers 3

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 stackoverflow.com/a/51962449/14401587

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

Sign up to request clarification or add additional context in comments.

9 Comments

Yes @Daniel this is enabled but still not working.
@at-in Choosed the right language? CTRL (or CMD) + P -> > Change Language Mode -> JavaScript
@at-in Another thing I noticed: You have no var, let or const before the variable, see stackoverflow.com/a/51962449/14401587
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 this
Just a suggestion @Daniel, you should add the let/var thing in your answer since this is also a problem someone else might face.
|
6

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.

Comments

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

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.