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 suggestions are not complete #352

Closed hexh250786313 closed 2 years ago

hexh250786313 commented 2 years ago

coc-tsserver's auto import suggestions are less than VSCode's. coc-tsserver's suggestions are not complete actually.

Both of Coc and VSCode work in my react project. There are several components have a same name. I input the compoent name. Then I get only one auto import suggestion from Coc but full suggestions from VSCode.

I have no idea what the issue related to.

chemzqm commented 2 years ago

It may be coc-tsserver's issue or not, you have to checkout the log https://github.com/neoclide/coc-tsserver#troubleshooting

hexh250786313 commented 2 years ago

I run :CocCommand tsserver.openTsServerLog and get completionInfo. That's a json file has 6156 lines and I find the component name I input which is only one result.

I do the same in VSCode and get a 6270 lines json file. There are 5 results about my input. Then I copy the other 4 items into coc-tsserver's completionInfo. I get a 6270 lines file as expected.

That is to say, the output info from coc-tsserver is indeed missing this part of the result.

hexh250786313 commented 2 years ago

@chemzqm I have tried lsp-tsserver and got the same result as coc-tsserver. Maybe there is something else different between VSCode's tsserver and coc-tsserver(or lsp-tsserver). And VSCode's has better performance.

chemzqm commented 2 years ago

Please provide evidence, could be different tsserver version

hexh250786313 commented 2 years ago

Ok, you are right maybe. I find VSCode's tsserver is /opt/visual-studio-code/resources/app/extensions/node_modules/typescript/lib/tsserver.js when my coc-tsserver use project-local tsserver.

But why "tsserver.tsdk": "/home/<user>/.nvm/versions/node/v16.5.0/lib/node_modules/typescript/lib" does not work for me then?

@chemzqm

chemzqm commented 2 years ago

lib at the end is not needed

hexh250786313 commented 2 years ago

@chemzqm Still not work. It only works after project's node_modules/typescript deleted. Is there any way to ignore the project-local tsserver?

By the way, coc-tsserver works beautifully using the global tsserver.

chemzqm commented 2 years ago

Use "tsserver.ignoreLocalTsserver": true, Readme need update for that.

hexh250786313 commented 2 years ago

@chemzqm Thx. Now it works very well.