From af66b3c56b1261d75aef9d231a7f0a6a74adda6f Mon Sep 17 00:00:00 2001 From: Erik Mertens Date: Mon, 4 Aug 2025 16:04:47 +0200 Subject: [PATCH] - updated to vue_ls 3.0 - fixed lua_ls lua version changed to 'LuaJIT' --- lazy-lock.json | 26 +++---- lua/plugins/blink.lua | 3 +- lua/plugins/lspconfig.lua | 156 ++++++++++++++++++++++++++++---------- lua/settings.lua | 43 +++++++---- 4 files changed, 156 insertions(+), 72 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index cef29a8..8b208e7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,24 +1,24 @@ { - "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "kanagawa-paper.nvim": { "branch": "master", "commit": "b0df20cca3b7087c06f241983b488190cc8e23af" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.nvim": { "branch": "main", "commit": "1b32a3f61f1f649cadc748bd4b7a32b4b4785d29" }, - "nvim-dap": { "branch": "master", "commit": "2edd6375692d9ac1053d50acfe415c1eb2ba92d0" }, - "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, - "nvim-lspconfig": { "branch": "master", "commit": "5e0e9c00d51fcb7efef0d4c49023f9593b38661e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "844d247d998c2f9a6a3baad8bb9748edc55ce69f" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" }, + "mini.nvim": { "branch": "main", "commit": "efff26174ca363c059f92e906753db47e81d870b" }, + "nvim-dap": { "branch": "master", "commit": "a479e25ed5b5d331fb46ee4b9e160ff02ac64310" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-lspconfig": { "branch": "master", "commit": "63a38440989c58e1f100373ab603fd24665bdc9a" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-rpgle": { "branch": "master", "commit": "8feaf44adf915c1df255920268beec710188df43" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, - "one-small-step-for-vimkind": { "branch": "main", "commit": "d9f832598e14f3b206b06f5738d02cebede65269" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" }, + "one-small-step-for-vimkind": { "branch": "main", "commit": "91b4e0fb0d640def73812aceb22dafb99261dd67" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index ce56426..839de65 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -46,7 +46,8 @@ return { -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` -- -- See the fuzzy documentation for more information - fuzzy = { implementation = "prefer_rust_with_warning" } + -- fuzzy = { implementation = "prefer_rust_with_warning" } + fuzzy = { implementation = "lua" } }, opts_extend = { "sources.default" } } diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 9e9dadc..7a1f106 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -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, } diff --git a/lua/settings.lua b/lua/settings.lua index 4782f39..d9e88c6 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,12 +1,3 @@ --- Keymaps --- Copy -vim.api.nvim_set_keymap("n", "", '"+gp', { noremap = true }) -vim.api.nvim_set_keymap("i", "", '"+gp', { noremap = true }) - --- Paste -vim.api.nvim_set_keymap("v", "", '"+y', { noremap = true }) -vim.api.nvim_set_keymap("n", "", '"+yy', { noremap = true }) - vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' @@ -57,13 +48,6 @@ vim.g.netrw_winsize = 25 vim.g.netrw_banner = 0 vim.g.netrw_localcopydircmd = "cp -r" --- -- terminal mode --- if jit.os == "Windows" then --- vim.o.shell = [[C:\Users\mertens\AppData\Local\Programs\Git\bin\bash.exe]] --- vim.api.nvim_set_keymap("t", "", [[]], { noremap = true, silent = true, desc = "Exit terminal mode" }) --- --- vim.o.backupdir = "C:\\Users\\mertens\\AppData\\Local\\nvim-data\\backup" --- end vim.diagnostic.config({ severity_sort = true, signs = { @@ -76,3 +60,30 @@ vim.diagnostic.config({ }, virtual_lines = { current_line = true } }) + +if vim.g.vscode then + +else + -- Keymaps + -- Copy + vim.api.nvim_set_keymap("n", "", '"+gp', { noremap = true }) + vim.api.nvim_set_keymap("i", "", '"+gp', { noremap = true }) + + -- Paste + vim.api.nvim_set_keymap("v", "", '"+y', { noremap = true }) + vim.api.nvim_set_keymap("n", "", '"+yy', { noremap = true }) +end + +-- terminal mode +if vim.uv.os_gethostname() == "LPEDV04" then + -- vim.o + -- if os.execute("set PATH=C:\\Users\\mertens\\AppData\\Local\\Programs\\jdk\\bin;%PATH%") then + -- vim.notify("success") + -- else + -- vim.notify("failed") + -- end + -- vim.o.shell = [[C:\Users\mertens\AppData\Local\Programs\Git\bin\bash.exe]] + -- vim.o.shellcmdflag = "-s" + -- vim.api.nvim_set_keymap("t", "", [[]], { noremap = true, silent = true, desc = "Exit terminal mode" }) + vim.o.backupdir = "C:\\Users\\mertens\\AppData\\Local\\nvim-data\\backup" +end