简体   繁体   English

Visual Studio代码JavaScript代码完成

[英]visual studio code JavaScript code completion

Trying to use the Microsoft VS code to develop node.js app. 尝试使用Microsoft VS代码开发node.js应用。 I'm starting with deciding if it worth the effort of learning this new IDE (new for me). 我首先要确定是否值得学习这个新的IDE(对我来说是新的)。 so for now i am not asking about node.js completion rather my own objects. 所以现在我不是在问node.js的完成,而是我自己的对象。

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. 我无法为自己的JS对象完成代码。 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. 我正在为JS对象中内置的node.js类获取代码完成。

It has some really great things built in it but i can't find a solution for this basic problem. 它内置了一些很棒的东西,但是我找不到这个基本问题的解决方案。

10x 10倍

It seems that VSCode does not detect this pattern. 似乎VSCode没有检测到此模式。 If you would use a ES6 class: 如果要使用ES6类:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM