jose-elias-alvarez / nvim-lsp-ts-utils

Utilities to improve the TypeScript development experience for Neovim's built-in LSP client.
The Unlicense
438 stars 18 forks source link

[FEATURE REQUEST] Add missing import under cursor #80

Closed nyngwang closed 2 years ago

nyngwang commented 2 years ago

Issues

Feature description

As title. I want each code action to add one missing import at a time. I don't like to import all missing imports at once. Could you provide this feature? I've searched it everywhere but didn't find a simple solution to this, but yours are very close.

Help

No

Implementation help

No response

jose-elias-alvarez commented 2 years ago

Sure, this should be pretty simple and I wanted to refactor the missing import functionality a bit, so I'll work on this soon.

jose-elias-alvarez commented 2 years ago

I added an initial version of this in 825630a5d28634fbb3663d1e605ff0a82b843d81 as :TSLspImportCurrent.

Technically, this implementation will add all missing imports on the current line. If there's demand for it, once 0.6.0 is released, I can use the new diagnostic API to match more precisely against the current cursor position.