mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat: updated v3
This commit is contained in:
parent
024996107b
commit
89db031726
2 changed files with 55 additions and 33 deletions
|
|
@ -62,11 +62,11 @@ return {
|
||||||
includePackageJsonAutoImports = "auto",
|
includePackageJsonAutoImports = "auto",
|
||||||
},
|
},
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
enumMemberValues = { enabled = true },
|
enumMemberValues = { enabled = false }, -- Disabled for Vue
|
||||||
functionLikeReturnTypes = { enabled = true },
|
functionLikeReturnTypes = { enabled = false }, -- Disabled for Vue
|
||||||
parameterNames = { enabled = "literals" },
|
parameterNames = { enabled = "off" }, -- Disabled for Vue
|
||||||
parameterTypes = { enabled = true },
|
parameterTypes = { enabled = false }, -- Disabled for Vue
|
||||||
propertyDeclarationTypes = { enabled = true },
|
propertyDeclarationTypes = { enabled = false }, -- Disabled for Vue
|
||||||
variableTypes = { enabled = false },
|
variableTypes = { enabled = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,22 @@ return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
volar = {
|
-- Remove the old volar configuration entirely
|
||||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
volar = false, -- This disables the old volar setup
|
||||||
|
|
||||||
|
-- Updated VTSLS configuration for vue-language-tools
|
||||||
|
vtsls = {
|
||||||
init_options = {
|
init_options = {
|
||||||
vue = {
|
plugins = {
|
||||||
hybridMode = true,
|
{
|
||||||
|
name = "@vue/typescript-plugin",
|
||||||
|
location = vim.fn.expand("$MASON/packages/vue-language-server/node_modules/@vue/language-server"),
|
||||||
|
languages = { "vue" },
|
||||||
|
configNamespace = "typescript",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
typescript = {
|
typescript = {
|
||||||
tsdk = vim.fn.getcwd() .. "/node_modules/typescript/lib",
|
-- Keep your existing TypeScript settings if needed
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
enumMemberValues = { enabled = false },
|
enumMemberValues = { enabled = false },
|
||||||
functionLikeReturnTypes = { enabled = false },
|
functionLikeReturnTypes = { enabled = false },
|
||||||
|
|
@ -37,6 +45,43 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
filetypes = {
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"vue",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- New vue_ls configuration
|
||||||
|
vue_ls = {
|
||||||
|
on_init = function(client)
|
||||||
|
client.handlers["tsserver/request"] = function(_, result, context)
|
||||||
|
local clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = "vtsls" })
|
||||||
|
if #clients == 0 then
|
||||||
|
vim.notify(
|
||||||
|
"Could not found `vtsls` lsp client, vue_lsp would not work without it.",
|
||||||
|
vim.log.levels.ERROR
|
||||||
|
)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ts_client = clients[1]
|
||||||
|
local param = unpack(result)
|
||||||
|
local id, command, payload = unpack(param)
|
||||||
|
ts_client:exec_cmd({
|
||||||
|
command = "typescript.tsserverRequest",
|
||||||
|
arguments = {
|
||||||
|
command,
|
||||||
|
payload,
|
||||||
|
},
|
||||||
|
}, { bufnr = context.bufnr }, function(_, r)
|
||||||
|
local response_data = { { id, r.body } }
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
client:notify("tsserver/response", response_data)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
vue = {
|
vue = {
|
||||||
updateImportsOnFileMove = { enabled = "always" },
|
updateImportsOnFileMove = { enabled = "always" },
|
||||||
|
|
@ -46,32 +91,9 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
vtsls = {
|
|
||||||
init_options = {
|
|
||||||
plugins = {
|
|
||||||
{
|
|
||||||
name = "@vue/typescript-plugin",
|
|
||||||
location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
|
|
||||||
languages = { "vue" },
|
|
||||||
configNamespace = "typescript",
|
|
||||||
enableForWorkspaceTypeScriptVersions = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filetypes = {
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"javascript.jsx",
|
|
||||||
"typescript",
|
|
||||||
"typescriptreact",
|
|
||||||
"typescript.tsx",
|
|
||||||
"vue",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Configure tsserver plugin
|
-- Configure tsserver plugin
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue