最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Intellisense not working with imports in Visual Studio Code - Stack Overflow

programmeradmin2浏览0评论

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 pletely 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:

{
    "pilerOptions": {
        "module": "es6"
    }
}

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 pletely 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:

{
    "pilerOptions": {
        "module": "es6"
    }
}
Share Improve this question edited Apr 1, 2016 at 14:11 koningdavid asked Apr 1, 2016 at 14:01 koningdavidkoningdavid 8,1137 gold badges37 silver badges47 bronze badges 2
  • I had a lot of issues using es2015 in Code. Ended up scrapping it and went back to atom... – erichardson30 Commented Apr 1, 2016 at 14:06
  • I have seem to found the issue here github./Microsoft/vscode-react-native/issues/61 it's a known bug – koningdavid Commented Apr 1, 2016 at 14:17
Add a ment  | 

1 Answer 1

Reset to default 11

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

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

The same occurs with

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

And others.

发布评论

评论列表(0)

  1. 暂无评论