neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

Auto import with CommonJS #293

Closed khaitranhq closed 3 years ago

khaitranhq commented 3 years ago

Describe

Can't require from module.exports or exports

Code

// root/a/b/c.js
'use strict';

module.exports = {
  LOGIN_WARNING: 'LOGIN_WARNING',
  RESET_PASSWORD: 'RESET_PASSWORD'
}
// root/d/e/f.js
console.log(RESET_PASSWORD)
// jsconfig.json
{
  "compilerOptions": {
    "module": "commonJS",
    "allowSyntheticDefaultImports": true
  },
  "exclude": ["node_modules"],
  "include": ["utils/*", "lib/**/*"] 
}

Expectation

Show suggestion for RESET_PASSWORD

Actuality

image

Moreover, I don't have any configuration about tsserver in coc-settings.json

chemzqm commented 3 years ago

Send your feature request to typescript project.

khaitranhq commented 3 years ago

I don't think this is the shortcoming of typescript. I tried with VS Code and it worked well.

fannheyward commented 3 years ago
截屏2021-06-04 下午6 14 35
khaitranhq commented 3 years ago

Thanks for the great update