Closed tylerschloesser closed 2 years ago
If you are using node_modules
be sure that in your tsconfig.json
/jsconfig.json
you have
{
"compilerOptions": {
"module": "es2020" // for example, you can also use es6 or others
"moduleResolution": "node" // MUST have
}
}
When you are using import/export
instead of require/module.exports
, tsserver
uses, as a default, classic
module resolution, that doesn't support non-relative imports from node_modules
folder. You can read more about the topic here.
If this doesn't solves your problem, you are going to give us more information!
Should be issue with your tsserver, checkout https://github.com/neoclide/coc-tsserver/blob/master/Readme.md#troubleshooting
We have typescript.preferences.includePackageJsonAutoImports
config now, maybe tsserver skipped your module for performance reason.
I can't tell if this is expected behavior but it's been bothering me for a while so I'm finally asking.
I always have to manually type out one import before coc-tsserver will let me autocomplete/autoimport anything from a package.
For example
So I manually type
Is this expected? Is asking tsserver to scan all possible imports asking for too much 😅