Erez
Erez

Reputation: 1953

visual studio code JavaScript code completion

Trying to use the Microsoft VS code to develop node.js app. I'm starting with deciding if it worth the effort of learning this new IDE (new for me). so for now i am not asking about node.js completion rather my own objects.

I read about adding code completion for different packages, but my problem is much more basic.

I can't get code completion for my own JS objects. Lets say i have this simple object:

function User() {
    this.name = '';
}

var me = new User();
me. ????

when trying to get to the name property of User after instantiating it there is no code completion for the object properties.

It is something i am doing wrong or is it a basic problem?

to be clear. i am getting code completion for the node.js classes built in JS objects.

It has some really great things built in it but i can't find a solution for this basic problem.

10x

Upvotes: 1

Views: 518

Answers (1)

Michael_Scharf
Michael_Scharf

Reputation: 34508

It seems that VSCode does not detect this pattern. If you would use a ES6 class:

class User {
    constructor() {
       this.name = '';
    }
}
var me = new User();
me. // now proposes name

Upvotes: 2

Related Questions