- updated to vue_ls 3.0
- fixed lua_ls lua version changed to 'LuaJIT'
This commit is contained in:
@@ -8,7 +8,14 @@ return { -- LSP Configuration & Plugins
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
config = function()
|
||||
local fidget = require("fidget")
|
||||
vim.notify = fidget.notify
|
||||
fidget.setup()
|
||||
end
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
@@ -78,7 +85,7 @@ return { -- LSP Configuration & Plugins
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = {
|
||||
"lua_ls", "rust_analyzer", "ts_ls", "vue_ls"
|
||||
"lua_ls", "rust_analyzer", "ltex_plus" --"ts_ls", "vue_ls",
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,8 +95,13 @@ return { -- LSP Configuration & Plugins
|
||||
Lua = {
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ';')
|
||||
},
|
||||
diagnostics = { globals = { "vim", "require" } },
|
||||
workspace = {
|
||||
-- library = vim.api.nvim_get_runtime_file('', true)
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
@@ -99,48 +111,108 @@ return { -- LSP Configuration & Plugins
|
||||
},
|
||||
}
|
||||
})
|
||||
-- local vue_path = vim.fn.stdpath("data") ..
|
||||
-- "/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin"
|
||||
-- vim.lsp.config('ts_ls', {
|
||||
-- init_options = {
|
||||
-- plugins = {
|
||||
-- {
|
||||
-- name = "@vue/typescript-plugin",
|
||||
-- -- location = vim.fn.stdpath("data") .. "/erikcustom/language-tools/packages/typescript-plugin",
|
||||
-- -- /mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin
|
||||
-- location = vue_path,
|
||||
-- languages = { "javascript", "typescript", "vue" },
|
||||
-- },
|
||||
-- },
|
||||
-- settings = {
|
||||
-- typescript = {
|
||||
-- tsserver = {
|
||||
-- useSyntaxServer = false,
|
||||
-- },
|
||||
-- inlayHints = {
|
||||
-- includeInlayParameterNameHints = 'all',
|
||||
-- includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
||||
-- includeInlayFunctionParameterTypeHints = true,
|
||||
-- includeInlayVariableTypeHints = true,
|
||||
-- includeInlayVariableTypeHintsWhenTypeMatchesName = true,
|
||||
-- includeInlayPropertyDeclarationTypeHints = true,
|
||||
-- includeInlayFunctionLikeReturnTypeHints = true,
|
||||
-- includeInlayEnumMemberValueHints = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- },
|
||||
-- filetypes = {
|
||||
-- "javascript",
|
||||
-- "typescript",
|
||||
-- "vue",
|
||||
-- },
|
||||
-- })
|
||||
local vue_language_server_path = vim.fn.expand '$MASON/packages' ..
|
||||
'/vue-language-server' .. '/node_modules/@vue/language-server'
|
||||
|
||||
local vue_plugin = {
|
||||
name = '@vue/typescript-plugin',
|
||||
location = vue_language_server_path,
|
||||
languages = { 'vue' },
|
||||
configNamespace = 'typescript',
|
||||
}
|
||||
local vtsls_config = {
|
||||
settings = {
|
||||
vtsls = {
|
||||
tsserver = {
|
||||
globalPlugins = {
|
||||
vue_plugin,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
}
|
||||
|
||||
local vue_ls_config = {
|
||||
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 find `vtsls` lsp client, `vue_ls` 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({
|
||||
title = 'vue_request_forward', -- You can give title anything as it's used to represent a command in the UI, `:h 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,
|
||||
}
|
||||
-- nvim 0.11 or above
|
||||
vim.lsp.config('vtsls', vtsls_config)
|
||||
vim.lsp.config('vue_ls', vue_ls_config)
|
||||
vim.lsp.enable({ 'vtsls', 'vue_ls' })
|
||||
|
||||
vim.lsp.config("ltex_plus", {
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "de-DE"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- local vue_path = vim.fn.stdpath("data") ..
|
||||
-- "/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin"
|
||||
|
||||
local vue_path = vim.fn.stdpath("data") ..
|
||||
"/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin"
|
||||
|
||||
vim.lsp.config('ts_ls', {
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
-- location = vim.fn.stdpath("data") .. "/erikcustom/language-tools/packages/typescript-plugin",
|
||||
-- /mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@vue/typescript-plugin
|
||||
location = vue_path,
|
||||
languages = { "javascript", "typescript", "vue" },
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
typescript = {
|
||||
tsserver = {
|
||||
useSyntaxServer = false,
|
||||
},
|
||||
inlayHints = {
|
||||
includeInlayParameterNameHints = 'all',
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
|
||||
includeInlayPropertyDeclarationTypeHints = true,
|
||||
includeInlayFunctionLikeReturnTypeHints = true,
|
||||
includeInlayEnumMemberValueHints = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"vue",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
Reference in New Issue
Block a user