mirror of
https://github.com/tuxdotrs/nixos-config.git
synced 2025-07-06 17:56: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 servers = { "tsserver", "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
|
||||
local servers = { "tailwindcss", "eslint", "gopls" }
|
||||
|
||||
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({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -37,7 +37,6 @@ M.mason = {
|
||||
"prettierd",
|
||||
"eslint-lsp",
|
||||
"eslint_d",
|
||||
"typescript-language-server",
|
||||
"tailwindcss-language-server",
|
||||
|
||||
-- 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",
|
||||
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
|
||||
|
Reference in New Issue
Block a user