mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(typescript-lang): Add missing import keymap
This commit is contained in:
parent
879e29504d
commit
a9919f04bf
1 changed files with 19 additions and 18 deletions
|
|
@ -1,3 +1,15 @@
|
|||
local source_action = function(name)
|
||||
return function()
|
||||
vim.lsp.buf.code_action({
|
||||
apply = true,
|
||||
context = {
|
||||
only = { string.format("source.%s.ts", name) },
|
||||
diagnostics = {},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
|
||||
-- add typescript to treesitter
|
||||
|
|
@ -21,28 +33,17 @@ return {
|
|||
keys = {
|
||||
{
|
||||
"<leader>co",
|
||||
function()
|
||||
vim.lsp.buf.code_action({
|
||||
apply = true,
|
||||
context = {
|
||||
only = { "source.organizeImports.ts" },
|
||||
diagnostics = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
source_action("organizeImports"),
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
{
|
||||
"<leader>cM",
|
||||
source_action("addMissingImports"),
|
||||
desc = "Add Missing Imports",
|
||||
},
|
||||
{
|
||||
"<leader>cR",
|
||||
function()
|
||||
vim.lsp.buf.code_action({
|
||||
apply = true,
|
||||
context = {
|
||||
only = { "source.removeUnused.ts" },
|
||||
diagnostics = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
source_action("removeUnused"),
|
||||
desc = "Remove Unused Imports",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue