✨ feat(nvim): add deno and dynamic activation to the typescript extra
This commit is contained in:
parent
19101125be
commit
fbe14666da
2 changed files with 27 additions and 58 deletions
|
@ -9,9 +9,26 @@ local inlayHints = {
|
|||
includeInlayEnumMemberValueHints = true,
|
||||
}
|
||||
|
||||
local function denoConfigExists()
|
||||
local root = require("lazyvim.util.root").get() .. "/deno.json"
|
||||
|
||||
if vim.fn.filereadable(root) == 1 then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return {
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, { "deno" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
|
@ -31,6 +48,15 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
denols = {
|
||||
root_dir = require("lspconfig").util.root_pattern("deno.json", "deno.jsonc", "deno.lock"),
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
tsserver = function(_, opts)
|
||||
-- Disable tsserver if denols is present
|
||||
return denoConfigExists()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -58,64 +84,6 @@ return {
|
|||
"typescriptreact",
|
||||
},
|
||||
},
|
||||
{
|
||||
-- TODO: Need to look more into this plugin
|
||||
"pmizio/typescript-tools.nvim",
|
||||
enabled = false,
|
||||
event = {
|
||||
"BufRead *.js,*.jsx,*.mjs,*.cjs,*ts,*tsx",
|
||||
"BufNewFile *.js,*.jsx,*.mjs,*.cjs,*ts,*tsx",
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
opts = {
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gD",
|
||||
"<Cmd>TSToolsGoToSourceDefinition<CR>",
|
||||
{ buffer = bufnr, desc = "Source Definition" }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<localleader>i",
|
||||
"<Cmd>TSToolsAddMissingImports<CR>",
|
||||
{ buffer = bufnr, desc = "Add missing imports" }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<localleader>o",
|
||||
"<Cmd>TSToolsOrganizeImports<CR>",
|
||||
{ buffer = bufnr, desc = "Organize imports" }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<localleader>r",
|
||||
"<Cmd>TSToolsRemoveUnused<CR>",
|
||||
{ buffer = bufnr, desc = "Remove unused variables" }
|
||||
)
|
||||
vim.keymap.set("n", "<localleader>f", "<Cmd>TSToolsFixAll<CR>", { buffer = bufnr, desc = "Fix all" })
|
||||
end,
|
||||
settings = {
|
||||
tsserver_file_preferences = {
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
includeInlayPropertyDeclarationTypeHints = true,
|
||||
includeInlayFunctionLikeReturnTypeHints = true,
|
||||
includeInlayEnumMemberValueHints = true,
|
||||
},
|
||||
},
|
||||
code_lens = "all",
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
optional = true,
|
||||
|
|
|
@ -23,6 +23,7 @@ clamtk 6.14-1
|
|||
cliphist 1:0.4.0-2
|
||||
cpupower 6.6-1
|
||||
dbeaver 23.3.1-1
|
||||
deno 1.39.1-1
|
||||
dialog 1:1.3_20231002-1
|
||||
dictd 1.13.1-5
|
||||
diff-so-fancy 1.4.4-2
|
||||
|
|
Loading…
Add table
Reference in a new issue