yioneko / nvim-vtsls

181 stars 4 forks source link

Is is possible to add commands for refactors? #10

Closed abdennourzahaf closed 3 months ago

abdennourzahaf commented 3 months ago

Adding commands to execute refactor code actions when available would be super helpful.

yioneko commented 3 months ago

I think the refactor actions is already provided through default vim.lsp.buf.code_action()? I do not see benefits of typing : command instead of picking through default gra code action mapping...

If you want to apply the specific action programmatically, there is vim.lsp.buf.code_action({ context = { only = { "your refactor kind" }}, apply = true }). Or you may be interested in luckasRanarison/clear-action.nvim which provide a predictable way to apply code actions.