mirror of
https://github.com/tuxdotrs/tnvim.git
synced 2025-07-06 21:36:34 +05:30
37 lines
889 B
Lua
37 lines
889 B
Lua
local configs = require("plugins.configs.lspconfig")
|
|
local on_attach = configs.on_attach
|
|
local capabilities = configs.capabilities
|
|
|
|
local lspconfig = require("lspconfig")
|
|
|
|
local servers = { "tsserver", "tailwindcss", "eslint" }
|
|
|
|
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
|
|
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
|