简体   繁体   中英

Visual studio code IntelliSense not working with NodeJS

I had been working with vs code for a while to develop NodeJS projects however IntelliSense not working for the classes and files I am writing, I had tried the solution inside here but it did not work for me, so anyone can help me to fix this problem.

VS code version:1.25.0

NodeJS version:8.9.4

An example about IntelliSense problem:

这是一个简单的类 This is a simple class

如您所见,当我从另一个文件导入它时,IntelliSense无法正常工作 As you can see when I am importing it from another file no IntelliSense is working 但是IntelliSense的node_module文件正在工作 But the node_module files IntelliSense is working!

I tried to solve it with a different syntax to export the class:

class Util {
    constructor() { }

    getNumber(x, y) {
        return x * y;
    }
}

exports.default = Util;

Then, I could import the class like this

const util = require('./../util/util').default;

And the autocompletion works:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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