feat(lsp): simpler API to deal with code actions

This commit is contained in:
Folke Lemaitre 2024-06-05 22:18:14 +02:00
parent e0a0123b18
commit 1bd4d2fc72
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
5 changed files with 20 additions and 45 deletions

View file

@ -53,15 +53,7 @@ return {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports" },
diagnostics = {},
},
})
end,
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},

View file

@ -31,15 +31,7 @@ return {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports" },
diagnostics = {},
},
})
end,
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},

View file

@ -85,30 +85,22 @@ return {
},
{
"<leader>co",
function()
require("vtsls").commands.organize_imports(0)
end,
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
{
"<leader>cM",
function()
require("vtsls").commands.add_missing_imports(0)
end,
LazyVim.lsp.action["source.addMissingImports.ts"],
desc = "Add missing imports",
},
{
"<leader>cu",
function()
require("vtsls").commands.remove_unused_imports(0)
end,
LazyVim.lsp.action["source.removeUnused.ts"],
desc = "Remove unused imports",
},
{
"<leader>cD",
function()
require("vtsls").commands.fix_all(0)
end,
LazyVim.lsp.action["source.fixAll.ts"],
desc = "Fix all diagnostics",
},
{