ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.54k stars 101 forks source link

Auto imports not triggering for typescript #71

Closed callebstrom closed 3 years ago

callebstrom commented 3 years ago

The plugin seems to work very well (and most importantly, fast as fuck) however, I can't seem to get the auto imports to work. I probably messed something up but I can't quite figure out what. Auto import works fine for me today via the built-in nvim LSP + lspinstall + compe so I think my LSP integration works as it should.

OS: OSX and Linux

After removing compe and trying to get auto imports using coq I end up with this: image

coq properly prints the correct import path in the pum footer but when I press enter to complete and add the import, the import is never added (although the symbol is auto completed properly). I run this very minimal coq lua config and use the default keybinds:

local coq = require('coq')
...
nvim_lsp[lsp].setup(coq().lsp_ensure_capabilities(lsp_config))

Is this a known issue or do I need to do some deep-diving to figure out what is up with my setup?

callebstrom commented 3 years ago

Seems to be working fine for Python though

ms-jpq commented 3 years ago

which pyhon lsp do you use?

i think i misunderstood the LSP specs and there are actually two ways to import the headers, and I only did one way, so only about half the servers work.

My best guess on the other method is I need to make an additional request to LSP before I apply the edits, so they can import.

That is pretty simple to do though, i will add that in later tonight.

callebstrom commented 3 years ago

For python I use pyright-langserver.

That would be amazing, can't wait for this to work so I can start using this plugin full-time. Thank you!

ms-jpq commented 3 years ago

ok this is the next issue i will work on, had some other higher priority issues

ms-jpq commented 3 years ago

by work on i mean tomorrow, cuz its 2am right now

by now*, ok i need to sleep

ahmadov commented 3 years ago

I have the same problem. The auto-import feature works fine for C++ but not for TypeScript/JavaScript.

I'm using this LSP: https://github.com/typescript-language-server/typescript-language-server

ms-jpq commented 3 years ago

PR https://github.com/ms-jpq/coq_nvim/pull/107 should close this.

please try it, this adds the secondary resolving of LSP completions.

coq_settings.clients.lsp.resolve_timeout controls the timeout for the secondary resolving. I think the default is roughly ok, but might be a bit low.

If LSP servers do not respond within the timeout, no headers will be imported.

ahmadov commented 3 years ago

@ms-jpq for me it works now. Thanks for a quick fix!

ms-jpq commented 3 years ago

SORRY I BROKE SOMETHING IN THE LAST PR

https://github.com/ms-jpq/coq_nvim/pull/108

please pull the latest for tix

callebstrom commented 3 years ago

Great stuff, works for me! :tada:

edmbn commented 2 years ago

Anybody have their dotfiles public? I have made everything work but automatic imports are not working. Tried all the things I read, as incrementing resolve timeout but nothing. I need to see a full example of someone implementing it but haven't find many information. Thank you!

minusf commented 2 years ago

auto header import for python does not seem to be working with pylsp, but a quick search did not reveal if it supports this feature or not.

xiaonengmiao commented 1 year ago

Anybody have their dotfiles public? I have made everything work but automatic imports are not working. Tried all the things I read, as incrementing resolve timeout but nothing. I need to see a full example of someone implementing it but haven't find many information. Thank you!

Me too. Everything seems to be working except for header imports shown here. I use pyright lsp.