ols
ols copied to clipboard
Implement source.organizeImports code action
In Go (with gopls), I run the source.organizeImports code action on file save to automatically include all missing imports in the file, it would be useful to have the same in ols.
Behavior would be the same as the current refactor.rewrite action, but doing it for all missing imports, instead of just the one currently selected by the cursor.
Example for Neovim, this currently works for importing just the current package:
:lua vim.lsp.buf.code_action { context = { only = { 'refactor.rewrite' }, diagnostics = {} }, apply = true }
This is missing and would allow importing all at once:
:lua vim.lsp.buf.code_action { context = { only = { 'source.organizeImports' }, diagnostics = {} }, apply = true }