简体   繁体   中英

Intellisense not working with imports in Visual Studio Code

When using javascript (es2015) imports the Intellisense seems to be broken.

When I am working in the same file, VSC autosuggests the methods from the object with the correct JSDoc information.

在此处输入图片说明

However, when importing the Class in another file, the Intellisense seems to be completely broken ( david.david, wtf? ).

在此处输入图片说明

Do I need to adjust any settings in Visual Studio Code to get this working? I tried adjusted my jsconfig file to es2015 imports and es6 as but that didn't work.

My jsconfig.json:

{
    "compilerOptions": {
        "module": "es6"
    }
}

Because you are using export without default you need to enable allowSyntheticDefaultImports

{
    "compilerOptions": {
        "target": "es6",
        "allowSyntheticDefaultImports": true
    }
}

The same occurs with

import fs from 'fs';
import axios from 'axios';

And others.

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