mirror of
https://github.com/tuxdotrs/tawm.git
synced 2025-07-06 13:06:35 +05:30
add typescript-tools plugin
This commit is contained in:
@ -4,33 +4,11 @@ local capabilities = configs.capabilities
|
|||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
local servers = { "tsserver", "tailwindcss", "eslint", "gopls" }
|
local servers = { "tailwindcss", "eslint", "gopls" }
|
||||||
|
|
||||||
local function organize_imports()
|
|
||||||
local params = {
|
|
||||||
command = "_typescript.organizeImports",
|
|
||||||
arguments = { vim.api.nvim_buf_get_name(0) },
|
|
||||||
title = "",
|
|
||||||
}
|
|
||||||
vim.lsp.buf.execute_command(params)
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
if lsp == "tsserver" then
|
|
||||||
lspconfig[lsp].setup({
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
commands = {
|
|
||||||
OrganizeImports = {
|
|
||||||
organize_imports,
|
|
||||||
description = "Organize Imports",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
else
|
|
||||||
lspconfig[lsp].setup({
|
lspconfig[lsp].setup({
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
@ -37,7 +37,6 @@ M.mason = {
|
|||||||
"prettierd",
|
"prettierd",
|
||||||
"eslint-lsp",
|
"eslint-lsp",
|
||||||
"eslint_d",
|
"eslint_d",
|
||||||
"typescript-language-server",
|
|
||||||
"tailwindcss-language-server",
|
"tailwindcss-language-server",
|
||||||
|
|
||||||
-- nix
|
-- nix
|
||||||
|
5
pkgs/nvchad/nvim/lua/configs/ts.lua
Normal file
5
pkgs/nvchad/nvim/lua/configs/ts.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
local on_attach = require("nvchad.configs.lspconfig").on_attach
|
||||||
|
|
||||||
|
require("typescript-tools").setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
@ -95,5 +95,20 @@ local plugins = {
|
|||||||
"folke/neodev.nvim",
|
"folke/neodev.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Language specific plugins
|
||||||
|
{
|
||||||
|
"pmizio/typescript-tools.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
|
||||||
|
config = function()
|
||||||
|
require("configs.ts")
|
||||||
|
end,
|
||||||
|
ft = {
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescriptreact",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return plugins
|
return plugins
|
||||||
|
Reference in New Issue
Block a user