replace tsserver with vtsls

This commit is contained in:
xfy
2024-07-25 17:28:38 +08:00
parent f3aea1a26c
commit cc896200c2
3 changed files with 44 additions and 11 deletions

View File

@ -29,10 +29,15 @@ require("mason-lspconfig").setup_handlers({
capabilities = capabilities,
}
if
server == "rust_analyzer"
or server == "clangd"
or server == "tsserver"
--[[ or server == "intelephense" ]]
server == "rust_analyzer"
or server == "clangd"
or server == "tsserver"
or server == "vtsls"
or server == "pylsp"
or server == "gopls"
or server == "jsonls"
or server == "yamlls"
--[[ or server == "intelephense" ]]
then
return nil
end
@ -47,7 +52,34 @@ lspconfig["rust_analyzer"].setup({
settings = rust_config,
})
lspconfig.tsserver.setup({
lspconfig.vtsls.setup {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
settings = {
vtsls = {
-- autoUseWorkspaceTsdk = true,
tsserver = {
globalPlugins = {
{
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
configNamespace = "typescript",
enableForWorkspaceTypeScriptVersions = true,
},
},
},
},
},
commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports",
},
},
on_attach = on_attach,
capabilities = capabilities,
}
--[[ lspconfig.vtsls.setup({
on_attach = on_attach,
capabilities = capabilities,
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
@ -66,7 +98,7 @@ lspconfig.tsserver.setup({
description = "Organize Imports",
},
},
})
}) ]]
lspconfig.clangd.setup({
on_attach = on_attach,

View File

@ -29,8 +29,8 @@ map("n", "<leader>gsy", "<cmd> GoTagAdd yaml <CR>", { desc = "Add yaml struct ta
-- lsp
map("n", "gh", function()
--[[ vim.lsp.buf.hover() ]]
require("pretty_hover").hover()
vim.lsp.buf.hover()
--[[ require("pretty_hover").hover() ]]
end, { desc = "󱙼 Hover lsp" })
map("n", "gr", "<CMD>Telescope lsp_references<CR>", { desc = " Lsp references" })
map("n", "<leader>ls", "<CMD>LspRestart<CR>", { desc = " Restart lsp" })

View File

@ -56,7 +56,8 @@ local plugins = {
"rust_analyzer",
"html",
"volar",
"tsserver",
--[[ "tsserver", ]]
"vtsls",
"tailwindcss",
"eslint",
"cssls",
@ -384,11 +385,11 @@ local plugins = {
event = "VeryLazy",
opts = {},
},
{
--[[ {
"Fildo7525/pretty_hover",
event = "LspAttach",
opts = {},
},
}, ]]
{
"folke/trouble.nvim",
cmd = "Trouble",