From a474aea1f9fcf0c7601914b1e53260067f621799 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 08:21:47 +0200 Subject: [PATCH 01/34] fix: rename `+a` which-key group to `ai`. Fixes #3392 --- lua/lazyvim/plugins/extras/coding/copilot-chat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua index 8cd0e2d1..090ade0c 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua @@ -53,7 +53,7 @@ return { init = function() LazyVim.on_load("which-key.nvim", function() vim.schedule(function() - require("which-key").register({ a = { name = "+CopilotChat (AI)" } }, { prefix = "" }) + require("which-key").register({ a = { name = "+ai" } }, { prefix = "" }) end) end) end, From 7782affc9038d13c407709ff00ada4c2c121fa92 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 31 May 2024 06:22:30 +0000 Subject: [PATCH 02/34] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 569245db..f607d609 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 30 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 31 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 9f2cc302463e3be0ca3a42845c0fc34e49e75bca Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 13:52:41 +0200 Subject: [PATCH 03/34] fix(lsp): better way of extending deeply nested lists. Fixes #3398 --- .../plugins/extras/lang/typescript.lua | 6 ------ lua/lazyvim/plugins/extras/lang/vue.lua | 20 ++++++------------- lua/lazyvim/util/init.lua | 13 ++++++++++++ 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index f9e841a8..e4fbd8f0 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -119,12 +119,6 @@ return { -- copy typescript settings to javascript opts.settings.javascript = vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {}) - local plugins = vim.tbl_get(opts.settings, "vtsls", "tsserver", "globalPlugins") - -- allow plugins to have a key for proper merging - -- remove the key here - if plugins then - opts.settings.vtsls.tsserver.globalPlugins = vim.tbl_values(plugins) - end end, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index dfc1d2f7..edeead89 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -27,20 +27,6 @@ return { -- Volar 2.0 has discontinued their "take over mode" which in previous version provided support for typescript in vue files. -- The new approach to get typescript support involves using the typescript language server along side volar. vtsls = { - settings = { - vtsls = { - tsserver = { - globalPlugins = { - -- Use typescript language server along with vue typescript plugin - vue = { - name = "@vue/typescript-plugin", - location = vue_typescript_plugin, - languages = { "vue" }, - }, - }, - }, - }, - }, filetypes = { "javascript", "javascriptreact", @@ -52,6 +38,12 @@ return { }, }, }) + + LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { + name = "@vue/typescript-plugin", + location = vue_typescript_plugin, + languages = { "vue" }, + }) end, }, } diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index c36ef101..1c677622 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -72,6 +72,19 @@ function M.on_very_lazy(fn) }) end +function M.extend(t, key, value) + local keys = vim.split(key, ".", { plain = true }) + for i = 1, #keys do + local k = keys[i] + t[k] = t[k] or {} + if type(t) ~= "table" then + return + end + t = t[k] + end + t[#t + 1] = value +end + ---@param name string function M.opts(name) local plugin = require("lazy.core.config").spec.plugins[name] From 3fadf6af8f4adc1788fb8adec1fd9850d12feaf8 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 31 May 2024 13:56:40 +0200 Subject: [PATCH 04/34] fix(rust): let rustaceans.nvim setup rust_analyzer (#3389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix this warning ```  Warn 11:52:45 PM notify.warn nvim-lspconfig.rust_analyzer has been setup. This will likely lead to conflicts with the rustaceanvim LSP client. See ':h rustaceanvim.mason' ``` fix taken from https://github.com/mrcjkb/rustaceanvim/blob/master/doc/mason.txt --- lua/lazyvim/plugins/extras/lang/rust.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 5a3c59d7..55203e7d 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -103,6 +103,11 @@ return { { "neovim/nvim-lspconfig", opts = { + setup = { + rust_analyzer = function() + return true + end, + }, servers = { taplo = { keys = { From 6678af37ee3100882b4c08451fa8aaa37e37fd69 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 13:59:51 +0200 Subject: [PATCH 05/34] fix(copilot-chat): no need to schedule which-key keys. just use default --- .../plugins/extras/coding/copilot-chat.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua index 090ade0c..7e636b65 100644 --- a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua +++ b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua @@ -50,13 +50,6 @@ return { mode = { "n", "v" }, }, }, - init = function() - LazyVim.on_load("which-key.nvim", function() - vim.schedule(function() - require("which-key").register({ a = { name = "+ai" } }, { prefix = "" }) - end) - end) - end, config = function(_, opts) local chat = require("CopilotChat") require("CopilotChat.integrations.cmp").setup() @@ -73,6 +66,16 @@ return { end, }, + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["a"] = { name = "+ai" }, + }, + }, + }, + -- Telescope integration { "nvim-telescope/telescope.nvim", From d02b73d72a85d72a57c3bcf0cfaef0cd50c81c37 Mon Sep 17 00:00:00 2001 From: Spedon Date: Fri, 31 May 2024 20:07:55 +0800 Subject: [PATCH 06/34] fix(ui): allow to disable the trouble lualine component with `vim.g.trouble_lualine = false` (#3391) * fix(ui): do not add trouble to lualine when aerial is enabled * refactor: make trouble lualine an option --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/config/options.lua | 3 +++ lua/lazyvim/plugins/ui.lua | 37 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index a1150151..1531ef53 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -28,6 +28,9 @@ vim.g.lazygit_config = true -- Hide deprecation warnings vim.g.deprecation_warnings = false +-- Show the current document symbols location from Trouble in lualine +vim.g.trouble_lualine = true + local opt = vim.opt opt.autowrite = true -- Enable auto write diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 94d72a12..190544a2 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -128,18 +128,7 @@ return { vim.o.laststatus = vim.g.lualine_laststatus - local trouble = require("trouble") - local symbols = trouble.statusline - and trouble.statusline({ - mode = "symbols", - groups = {}, - title = false, - filter = { range = true }, - format = "{kind_icon}{symbol.name:Normal}", - hl_group = "lualine_c_normal", - }) - - return { + local opts = { options = { theme = "auto", globalstatus = true, @@ -162,10 +151,6 @@ return { }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, { LazyVim.lualine.pretty_path() }, - { - symbols and symbols.get, - cond = symbols and symbols.has, - }, }, lualine_x = { -- stylua: ignore @@ -222,6 +207,26 @@ return { }, extensions = { "neo-tree", "lazy" }, } + + -- do not add trouble symbols if aerial is enabled + if vim.g.trouble_lualine then + local trouble = require("trouble") + local symbols = trouble.statusline + and trouble.statusline({ + mode = "symbols", + groups = {}, + title = false, + filter = { range = true }, + format = "{kind_icon}{symbol.name:Normal}", + hl_group = "lualine_c_normal", + }) + table.insert(opts.sections.lualine_c, { + symbols and symbols.get, + cond = symbols and symbols.has, + }) + end + + return opts end, }, From ae381c91a1ec420cce082443501bace1ac7aaa3f Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 14:24:27 +0200 Subject: [PATCH 07/34] Revert "fix(rust): let rustaceans.nvim setup rust_analyzer (#3389)" This reverts commit 3fadf6af8f4adc1788fb8adec1fd9850d12feaf8. --- lua/lazyvim/plugins/extras/lang/rust.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/rust.lua b/lua/lazyvim/plugins/extras/lang/rust.lua index 55203e7d..5a3c59d7 100644 --- a/lua/lazyvim/plugins/extras/lang/rust.lua +++ b/lua/lazyvim/plugins/extras/lang/rust.lua @@ -103,11 +103,6 @@ return { { "neovim/nvim-lspconfig", opts = { - setup = { - rust_analyzer = function() - return true - end, - }, servers = { taplo = { keys = { From abc6554e24ff97bfc630fe1d91827e02f826b1fa Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 16:49:47 +0200 Subject: [PATCH 08/34] fix(ui): remove old alpha.nvim warning --- lua/lazyvim/plugins/ui.lua | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 190544a2..6f371351 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -320,20 +320,6 @@ return { -- ui components { "MunifTanjim/nui.nvim", lazy = true }, - { - "goolord/alpha-nvim", - optional = true, - enabled = function() - LazyVim.warn({ - "`dashboard.nvim` is now the default LazyVim starter plugin.", - "", - "To keep using `alpha.nvim`, please enable the `lazyvim.plugins.extras.ui.alpha` extra.", - "Or to hide this message, remove the alpha spec from your config.", - }) - return false - end, - }, - { "nvimdev/dashboard-nvim", lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin. From 07ff12f5eb2be06b9783c334a08f90466a0bc776 Mon Sep 17 00:00:00 2001 From: Emma Eilefsen Glenna <95104378+eilefsen@users.noreply.github.com> Date: Fri, 31 May 2024 20:52:01 +0200 Subject: [PATCH 09/34] fix(extras.lang.vue) missing typescript autocomplete in .vue files (#3401) * Fix missing autocomplete in .vue files The existing Vue extra was not properly configuring vtsls to use the globalPlugin: '@vue/typescript-plugin' This commit fixes missing typescript autocomplete in .vue files. * move @vue/typescript-plugin back to extend function call * tidy LazyVim.extend() arguments --- lua/lazyvim/plugins/extras/lang/vue.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index edeead89..fc9fb59b 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -18,9 +18,9 @@ return { { "neovim/nvim-lspconfig", opts = function(_, opts) - local vue_typescript_plugin = require("mason-registry").get_package("vue-language-server"):get_install_path() - .. "/node_modules/@vue/language-server" - .. "/node_modules/@vue/typescript-plugin" + local vue_typescript_plugin = require("mason-registry") + .get_package("vue-language-server") + :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin" opts.servers = vim.tbl_deep_extend("force", opts.servers, { volar = {}, @@ -38,12 +38,14 @@ return { }, }, }) - - LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { + LazyVim.extend(opts.servers.vtsls.settings.vtsls.tsserver.globalPlugins, { name = "@vue/typescript-plugin", location = vue_typescript_plugin, languages = { "vue" }, + configNamespace = "typescript", }) end, + + }, } From e7430b0776c13e9ab3f42a1b9aee84561bd07c0a Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 20:53:44 +0200 Subject: [PATCH 10/34] fix(vue): correctly add plugins. See #3401 --- lua/lazyvim/plugins/extras/lang/vue.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index fc9fb59b..f3bd0926 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -18,9 +18,9 @@ return { { "neovim/nvim-lspconfig", opts = function(_, opts) - local vue_typescript_plugin = require("mason-registry") - .get_package("vue-language-server") - :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin" + local vue_typescript_plugin = require("mason-registry").get_package("vue-language-server"):get_install_path() + .. "/node_modules/@vue/language-server" + .. "/node_modules/@vue/typescript-plugin" opts.servers = vim.tbl_deep_extend("force", opts.servers, { volar = {}, @@ -38,14 +38,12 @@ return { }, }, }) - LazyVim.extend(opts.servers.vtsls.settings.vtsls.tsserver.globalPlugins, { + LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { name = "@vue/typescript-plugin", location = vue_typescript_plugin, languages = { "vue" }, configNamespace = "typescript", }) end, - - }, } From 146c87cd786854b9225ad49ad39acbcb4b7fff0b Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Sat, 1 Jun 2024 00:46:30 +0300 Subject: [PATCH 11/34] fix(trouble): don't enable symbols keymap when `outline.nvim` enabled (#3408) --- lua/lazyvim/plugins/extras/editor/outline.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/outline.lua b/lua/lazyvim/plugins/extras/editor/outline.lua index c571d789..07c46705 100644 --- a/lua/lazyvim/plugins/extras/editor/outline.lua +++ b/lua/lazyvim/plugins/extras/editor/outline.lua @@ -1,4 +1,12 @@ return { + -- Disable `cs` keymap so it doesn't conflict with `outline.nvim` + { + "folke/trouble.nvim", + optional = true, + keys = { + { "cs", false }, + }, + }, { "hedyhli/outline.nvim", keys = { { "cs", "Outline", desc = "Toggle Outline" } }, From 135150307b53a5b51f2f0c149ca7f426a67eb8f1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 31 May 2024 23:47:48 +0200 Subject: [PATCH 12/34] fix(aerial): disable trouble leader-cs keymap when aerial extra is enabled --- lua/lazyvim/plugins/extras/editor/aerial.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/editor/aerial.lua b/lua/lazyvim/plugins/extras/editor/aerial.lua index 15a209ba..afa2a602 100644 --- a/lua/lazyvim/plugins/extras/editor/aerial.lua +++ b/lua/lazyvim/plugins/extras/editor/aerial.lua @@ -49,6 +49,14 @@ return { }, }, + { + "folke/trouble.nvim", + optional = true, + keys = { + { "cs", false }, + }, + }, + -- Telescope integration { "nvim-telescope/telescope.nvim", From 9d999fa210065a9903634f1e1a2053627d529dec Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 08:31:10 +0200 Subject: [PATCH 13/34] refactor: refactored mason/typescript/vue support --- lua/lazyvim/plugins/extras/lang/python.lua | 3 +- .../plugins/extras/lang/typescript.lua | 14 +++++- lua/lazyvim/plugins/extras/lang/vue.lua | 47 +++++++++---------- lua/lazyvim/plugins/lsp/init.lua | 10 ++-- lua/lazyvim/plugins/xtras.lua | 1 + lua/lazyvim/util/init.lua | 32 ++++++++++++- 6 files changed, 70 insertions(+), 37 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index ac59a543..7a716b3e 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -106,8 +106,7 @@ return { { "dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" }, }, config = function() - local path = require("mason-registry").get_package("debugpy"):get_install_path() - require("dap-python").setup(path .. "/venv/bin/python") + require("dap-python").setup(LazyVim.get_pkg_path("debugpy", "/venv/bin/python")) end, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index e4fbd8f0..482af408 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -32,10 +32,21 @@ return { enabled = false, }, vtsls = { + -- explicitly add default filetypes, so that we can extend + -- them in related extras + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + }, settings = { complete_function_calls = true, vtsls = { enableMoveToFileCodeAction = true, + autoUseWorkspaceTsdk = true, experimental = { completion = { enableServerSideFuzzyMatch = true, @@ -147,8 +158,7 @@ return { command = "node", -- 💀 Make sure to update this path to point to your installation args = { - require("mason-registry").get_package("js-debug-adapter"):get_install_path() - .. "/js-debug/src/dapDebugServer.js", + LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"), "${port}", }, }, diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index f3bd0926..6c47d56e 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -6,6 +6,9 @@ return { }) end, + -- depends on the typescript extra + { import = "lazyvim.plugins.extras.lang.typescript" }, + { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) @@ -15,34 +18,30 @@ return { end, }, + -- Add LSP servers + { + "neovim/nvim-lspconfig", + opts = { + servers = { + volar = {}, + vtsls = {}, + }, + }, + }, + + -- Configure tsserver plugin { "neovim/nvim-lspconfig", opts = function(_, opts) - local vue_typescript_plugin = require("mason-registry").get_package("vue-language-server"):get_install_path() - .. "/node_modules/@vue/language-server" - .. "/node_modules/@vue/typescript-plugin" - - opts.servers = vim.tbl_deep_extend("force", opts.servers, { - volar = {}, - -- Volar 2.0 has discontinued their "take over mode" which in previous version provided support for typescript in vue files. - -- The new approach to get typescript support involves using the typescript language server along side volar. - vtsls = { - filetypes = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - "vue", - }, - }, - }) + table.insert(opts.servers.vtsls.filetypes, "vue") LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { - name = "@vue/typescript-plugin", - location = vue_typescript_plugin, - languages = { "vue" }, - configNamespace = "typescript", + { + name = "@vue/typescript-plugin", + location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"), + languages = { "vue" }, + configNamespace = "typescript", + enableForWorkspaceTypeScriptVersions = true, + }, }) end, }, diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 414bb655..ac84b743 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -284,19 +284,15 @@ return { }) end, 100) end) - local function ensure_installed() + + mr.refresh(function() for _, tool in ipairs(opts.ensure_installed) do local p = mr.get_package(tool) if not p:is_installed() then p:install() end end - end - if mr.refresh then - mr.refresh(ensure_installed) - else - ensure_installed() - end + end) end, }, } diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 6c789b0f..87b11fb7 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -5,6 +5,7 @@ local prios = { ["lazyvim.plugins.extras.editor.aerial"] = 100, ["lazyvim.plugins.extras.editor.outline"] = 100, ["lazyvim.plugins.extras.editor.trouble-v3"] = 100, + ["lazyvim.plugins.extras.lang.typescript"] = 5, ["lazyvim.plugins.extras.ui.edgy"] = 2, ["lazyvim.plugins.extras.test.core"] = 1, ["lazyvim.plugins.extras.dap.core"] = 1, diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 1c677622..9b2135f5 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -72,7 +72,12 @@ function M.on_very_lazy(fn) }) end -function M.extend(t, key, value) +---@generic T +---@param t T[] +---@param key string +---@param values T[] +---@return T[]? +function M.extend(t, key, values) local keys = vim.split(key, ".", { plain = true }) for i = 1, #keys do local k = keys[i] @@ -82,7 +87,7 @@ function M.extend(t, key, value) end t = t[k] end - t[#t + 1] = value + return vim.list_extend(t, values) end ---@param name string @@ -211,4 +216,27 @@ function M.create_undo() end end +--- Gets a path to a package in the Mason registry. +--- Prefer this to `get_package`, since the package might not always be +--- available yet and trigger errors. +---@param pkg string +---@param path? string +function M.get_pkg_path(pkg, path) + path = path or "" + local ret = vim.env.MASON .. "/packages/" .. pkg .. "/" .. path + if not vim.loop.fs_stat(ret) then + M.warn(("Mason package path not found for **%s**:\n- `%s`"):format(pkg, path)) + end + return ret +end + +--- Override the default title for notifications. +for _, level in ipairs({ "info", "warn", "error" }) do + M[level] = function(msg, opts) + opts = opts or {} + opts.title = opts.title or "LazyVim" + return LazyUtil[level](msg, opts) + end +end + return M From 683aaeb75b46f182f2a2dca3b8416151de296626 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 08:33:24 +0200 Subject: [PATCH 14/34] feat(astro): added support for ts-plugin, but won't work till mason-registry PR is merged. See #3364 --- lua/lazyvim/plugins/extras/lang/astro.lua | 22 ++++++++++++++++++++++ lua/lazyvim/util/init.lua | 7 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/astro.lua b/lua/lazyvim/plugins/extras/lang/astro.lua index 67af3e4d..c4192e27 100644 --- a/lua/lazyvim/plugins/extras/lang/astro.lua +++ b/lua/lazyvim/plugins/extras/lang/astro.lua @@ -10,6 +10,9 @@ return { }) end, + -- depends on the typescript extra + { import = "lazyvim.plugins.extras.lang.typescript" }, + { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) @@ -19,6 +22,7 @@ return { end, }, + -- LSP Servers { "neovim/nvim-lspconfig", opts = { @@ -27,4 +31,22 @@ return { }, }, }, + + -- Configure tsserver plugin + { + "neovim/nvim-lspconfig", + opts = function(_, opts) + LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { + { + name = "@astrojs/ts-plugin", + location = LazyVim.get_pkg_path( + "astro-language-server", + "/node_modules/@astrojs/ts-plugin", + { warn = false } + ), + enableForWorkspaceTypeScriptVersions = true, + }, + }) + end, + }, } diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 9b2135f5..12c7abd4 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -221,10 +221,13 @@ end --- available yet and trigger errors. ---@param pkg string ---@param path? string -function M.get_pkg_path(pkg, path) +---@param opts? { warn?: boolean } +function M.get_pkg_path(pkg, path, opts) + opts = opts or {} + opts.warn = opts.warn == nil and true or opts.warn path = path or "" local ret = vim.env.MASON .. "/packages/" .. pkg .. "/" .. path - if not vim.loop.fs_stat(ret) then + if opts.warn and not vim.loop.fs_stat(ret) then M.warn(("Mason package path not found for **%s**:\n- `%s`"):format(pkg, path)) end return ret From 679c76a8f3566c091afc07302f27d52023949fc8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 1 Jun 2024 06:34:09 +0000 Subject: [PATCH 15/34] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index f607d609..39d95790 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 May 31 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 01 ============================================================================== Table of Contents *LazyVim-table-of-contents* From 276b50e389054bd2314f03c7d4a16f855eed69ac Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 08:42:00 +0200 Subject: [PATCH 16/34] style: docs for LazyVim.extend --- lua/lazyvim/util/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 12c7abd4..845fdd1b 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -72,6 +72,9 @@ function M.on_very_lazy(fn) }) end +--- This extends a deeply nested list with a key in a table +--- that is a dot-separated string. +--- The nested list will be created if it does not exist. ---@generic T ---@param t T[] ---@param key string From a6df15a63fdeaf25895fb2d97910e3e099a95d0c Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 08:48:29 +0200 Subject: [PATCH 17/34] fix(util): make sure mason is loaded when getting package paths --- lua/lazyvim/util/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 845fdd1b..2dca92ba 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -226,6 +226,7 @@ end ---@param path? string ---@param opts? { warn?: boolean } function M.get_pkg_path(pkg, path, opts) + require("mason") -- make sure Mason is loaded opts = opts or {} opts.warn = opts.warn == nil and true or opts.warn path = path or "" From 4e62df4269a9300c17f6bf23acfcb9dd0729b6c3 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 08:48:44 +0200 Subject: [PATCH 18/34] fix(health): remove old deprecated module checks --- lua/lazyvim/util/plugin.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index 084b2ff9..9886122b 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -17,11 +17,7 @@ M.deprecated_extras = { ["lazyvim.plugins.extras.editor.trouble-v3"] = "Trouble v3 has been merged in main", } -M.deprecated_modules = { - ["null-ls"] = "lsp.none-ls", - ["nvim-navic.lib"] = "editor.navic", - ["nvim-navic"] = "editor.navic", -} +M.deprecated_modules = {} ---@type table M.renames = { From 7598a7503df0fd7912e81fdc9a0eb7635795605b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 09:08:09 +0200 Subject: [PATCH 19/34] feat(extras): added extra for svelte. Full support will be enabled once my mason PR gets merged --- lua/lazyvim/plugins/extras/lang/svelte.lua | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/svelte.lua diff --git a/lua/lazyvim/plugins/extras/lang/svelte.lua b/lua/lazyvim/plugins/extras/lang/svelte.lua new file mode 100644 index 00000000..7b0588d2 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/svelte.lua @@ -0,0 +1,52 @@ +return { + recommended = function() + return LazyVim.extras.wants({ + ft = "svelte", + root = { + "svelte.config.js", + "svelte.config.mjs", + "svelte.config.cjs", + }, + }) + end, + + -- depends on the typescript extra + { import = "lazyvim.plugins.extras.lang.typescript" }, + + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "svelte" }) + end + end, + }, + + -- LSP Servers + { + "neovim/nvim-lspconfig", + opts = { + servers = { + svelte = {}, + }, + }, + }, + + -- Configure tsserver plugin + { + "neovim/nvim-lspconfig", + opts = function(_, opts) + LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", { + { + name = "typescript-svelte-plugin", + location = LazyVim.get_pkg_path( + "svelte-language-server", + "/node_modules/typescript-svelte-plugin", + { warn = false } + ), + enableForWorkspaceTypeScriptVersions = true, + }, + }) + end, + }, +} From 2e9da7f41f826df5fcfff1897f18ebb277ec5f0c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 1 Jun 2024 09:52:43 +0200 Subject: [PATCH 20/34] chore(main): release 12.2.0 (#3377) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d09e9482..e5eb5ac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [12.2.0](https://github.com/LazyVim/LazyVim/compare/v12.1.0...v12.2.0) (2024-06-01) + + +### Features + +* **astro:** added support for ts-plugin, but won't work till mason-registry PR is merged. See [#3364](https://github.com/LazyVim/LazyVim/issues/3364) ([683aaeb](https://github.com/LazyVim/LazyVim/commit/683aaeb75b46f182f2a2dca3b8416151de296626)) +* **extras:** added extra for svelte. Full support will be enabled once my mason PR gets merged ([7598a75](https://github.com/LazyVim/LazyVim/commit/7598a7503df0fd7912e81fdc9a0eb7635795605b)) +* **typescript:** add keymap for remove unused imports ([#3376](https://github.com/LazyVim/LazyVim/issues/3376)) ([0a93737](https://github.com/LazyVim/LazyVim/commit/0a9373733f79be5edb4ccb8d9268a700c1e3faad)) + + +### Bug Fixes + +* **aerial:** disable trouble leader-cs keymap when aerial extra is enabled ([1351503](https://github.com/LazyVim/LazyVim/commit/135150307b53a5b51f2f0c149ca7f426a67eb8f1)) +* **copilot-chat:** no need to schedule which-key keys. just use default ([6678af3](https://github.com/LazyVim/LazyVim/commit/6678af37ee3100882b4c08451fa8aaa37e37fd69)) +* **extras:** `underline = false` for setting diagnostics ([#3379](https://github.com/LazyVim/LazyVim/issues/3379)) ([060f56d](https://github.com/LazyVim/LazyVim/commit/060f56d6d429c5ee3fd35f4fa0c152f4a42781ca)) +* **health:** remove old deprecated module checks ([4e62df4](https://github.com/LazyVim/LazyVim/commit/4e62df4269a9300c17f6bf23acfcb9dd0729b6c3)) +* **lsp:** better way of extending deeply nested lists. Fixes [#3398](https://github.com/LazyVim/LazyVim/issues/3398) ([9f2cc30](https://github.com/LazyVim/LazyVim/commit/9f2cc302463e3be0ca3a42845c0fc34e49e75bca)) +* rename `+a` which-key group to `ai`. Fixes [#3392](https://github.com/LazyVim/LazyVim/issues/3392) ([a474aea](https://github.com/LazyVim/LazyVim/commit/a474aea1f9fcf0c7601914b1e53260067f621799)) +* **rust:** let rustaceans.nvim setup rust_analyzer ([#3389](https://github.com/LazyVim/LazyVim/issues/3389)) ([3fadf6a](https://github.com/LazyVim/LazyVim/commit/3fadf6af8f4adc1788fb8adec1fd9850d12feaf8)) +* **trouble:** don't enable symbols keymap when `outline.nvim` enabled ([#3408](https://github.com/LazyVim/LazyVim/issues/3408)) ([146c87c](https://github.com/LazyVim/LazyVim/commit/146c87cd786854b9225ad49ad39acbcb4b7fff0b)) +* **ui:** allow to disable the trouble lualine component with `vim.g.trouble_lualine = false` ([#3391](https://github.com/LazyVim/LazyVim/issues/3391)) ([d02b73d](https://github.com/LazyVim/LazyVim/commit/d02b73d72a85d72a57c3bcf0cfaef0cd50c81c37)) +* **ui:** remove old alpha.nvim warning ([abc6554](https://github.com/LazyVim/LazyVim/commit/abc6554e24ff97bfc630fe1d91827e02f826b1fa)) +* **util:** make sure mason is loaded when getting package paths ([a6df15a](https://github.com/LazyVim/LazyVim/commit/a6df15a63fdeaf25895fb2d97910e3e099a95d0c)) +* **vue:** correctly add plugins. See [#3401](https://github.com/LazyVim/LazyVim/issues/3401) ([e7430b0](https://github.com/LazyVim/LazyVim/commit/e7430b0776c13e9ab3f42a1b9aee84561bd07c0a)) + ## [12.1.0](https://github.com/LazyVim/LazyVim/compare/v12.0.0...v12.1.0) (2024-05-30) From c33d6578a8b2ce03cab58d5952d717064125ef5d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 10:25:08 +0200 Subject: [PATCH 21/34] fix(util): make sure doc gen works --- lua/lazyvim/util/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 2dca92ba..05d96db5 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -226,11 +226,12 @@ end ---@param path? string ---@param opts? { warn?: boolean } function M.get_pkg_path(pkg, path, opts) - require("mason") -- make sure Mason is loaded + pcall(require, "mason") -- make sure Mason is loaded. Will fail when generating docs + local root = vim.env.MASON or (vim.fn.stdpath("data") .. "/mason") opts = opts or {} opts.warn = opts.warn == nil and true or opts.warn path = path or "" - local ret = vim.env.MASON .. "/packages/" .. pkg .. "/" .. path + local ret = root .. "/packages/" .. pkg .. "/" .. path if opts.warn and not vim.loop.fs_stat(ret) then M.warn(("Mason package path not found for **%s**:\n- `%s`"):format(pkg, path)) end From c98fbef3b56fe6ba709254cdc90c8c46c078d555 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 11:20:50 +0200 Subject: [PATCH 22/34] fix(json): added *.json to recommended --- lua/lazyvim/plugins/extras/lang/json.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/json.lua b/lua/lazyvim/plugins/extras/lang/json.lua index 5f94caf7..3f1de268 100644 --- a/lua/lazyvim/plugins/extras/lang/json.lua +++ b/lua/lazyvim/plugins/extras/lang/json.lua @@ -2,6 +2,7 @@ return { recommended = function() return LazyVim.extras.wants({ ft = { "json", "jsonc", "json5" }, + root = { "*.json" }, }) end, From c69553e1942a646917c92f3643a2ca78eeb19adf Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 11:21:03 +0200 Subject: [PATCH 23/34] fix(dot): added dot to recommended --- lua/lazyvim/plugins/extras/util/dot.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lazyvim/plugins/extras/util/dot.lua b/lua/lazyvim/plugins/extras/util/dot.lua index ad4e2278..8066d363 100644 --- a/lua/lazyvim/plugins/extras/util/dot.lua +++ b/lua/lazyvim/plugins/extras/util/dot.lua @@ -7,6 +7,8 @@ local function have(path) end return { + recommended = true, + desc = "Language support for dotfiles", { "neovim/nvim-lspconfig", opts = { From 45b92aa381243417462fb4aac92478ce50b4e126 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 11:21:28 +0200 Subject: [PATCH 24/34] feat(extras): split enabled in enabled plugins/languages --- lua/lazyvim/util/extras.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 9cae88e4..0a9d50c6 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -225,7 +225,8 @@ function X:render() title = "Recommended Languages", empty = false, }) - self:section({ enabled = true, title = "Enabled" }) + self:section({ enabled = true, exclude = "^lang%.", title = "Enabled Plugins" }) + self:section({ enabled = true, title = "Enabled Languages" }) self:section({ recommended = true, title = "Recommended Plugins", empty = false }) self:section({ title = "Plugins", exclude = "^lang%." }) self:section({ title = "Languages" }) From b2858a297a465546e9f34d5c3e9d42b9716048eb Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 11:22:17 +0200 Subject: [PATCH 25/34] feat(extras): show extras imported in other extras --- lua/lazyvim/util/extras.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 0a9d50c6..9cd16a3e 100644 --- a/lua/lazyvim/util/extras.lua +++ b/lua/lazyvim/util/extras.lua @@ -17,6 +17,7 @@ local Text = require("lazy.view.text") ---@field enabled boolean ---@field managed boolean ---@field recommended? boolean +---@field imports string[] ---@field row? number ---@field section? string ---@field plugins string[] @@ -82,7 +83,16 @@ end ---@param source LazyExtraSource function M.get_extra(source, modname) local enabled = vim.tbl_contains(M.state, modname) - local spec = Plugin.Spec.new({ import = modname }, { optional = true }) + local spec = Plugin.Spec.new(nil, { optional = true }) + spec:parse({ import = modname }) + local imports = vim.tbl_filter(function(x) + return x ~= modname + end, spec.modules) + if #imports > 0 then + spec = Plugin.Spec.new(nil, { optional = true }) + spec.modules = vim.deepcopy(imports) + spec:parse({ import = modname }) + end local plugins = {} ---@type string[] local optional = {} ---@type string[] for _, p in pairs(spec.plugins) do @@ -107,6 +117,7 @@ function M.get_extra(source, modname) name = modname:sub(#source.module + 2), module = modname, enabled = enabled, + imports = imports, desc = require(modname).desc, recommended = recommended, managed = vim.tbl_contains(Config.json.data.extras, modname) or not enabled, @@ -254,6 +265,10 @@ function X:extra(extra) if extra.source.name ~= "LazyVim" then self.text:append(" "):append(LazyConfig.options.ui.icons.event .. " " .. extra.source.name, "LazyReasonEvent") end + for _, import in ipairs(extra.imports) do + import = import:gsub("^lazyvim.plugins.extras.", "") + self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. import, "LazyReasonStart") + end for _, plugin in ipairs(extra.plugins) do self.text:append(" "):append(LazyConfig.options.ui.icons.plugin .. "" .. plugin, "LazyReasonPlugin") end From 595069d50114e841935ac00e1d4d734ed1756341 Mon Sep 17 00:00:00 2001 From: Aman9das <39594914+Aman9das@users.noreply.github.com> Date: Sat, 1 Jun 2024 18:35:34 +0530 Subject: [PATCH 26/34] R.lua make R output themed by neovim theme (#3416) --- lua/lazyvim/plugins/extras/lang/r.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lazyvim/plugins/extras/lang/r.lua b/lua/lazyvim/plugins/extras/lang/r.lua index c89828c4..49b3dd9c 100644 --- a/lua/lazyvim/plugins/extras/lang/r.lua +++ b/lua/lazyvim/plugins/extras/lang/r.lua @@ -43,6 +43,7 @@ return { pdfviewer = "" }, config = function(_, opts) + vim.g.rout_follow_colorscheme = true require("r").setup(opts) require("r.pdf.generic").open = vim.ui.open end, From 8024201e75b471eac5e399dcb6c8ec4f3f55e2a2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 1 Jun 2024 20:46:56 +0200 Subject: [PATCH 27/34] refactor: move 0.9 stuff to a compat layer. Cleaner this way --- lua/lazyvim/plugins/coding.lua | 81 +++++++++++-------------- lua/lazyvim/plugins/compat/nvim-0_9.lua | 8 +++ lua/lazyvim/plugins/lsp/init.lua | 2 +- lua/lazyvim/plugins/xtras.lua | 15 ++++- lua/lazyvim/types.lua | 3 + 5 files changed, 61 insertions(+), 48 deletions(-) create mode 100644 lua/lazyvim/plugins/compat/nvim-0_9.lua diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index d143852f..a3c91c3d 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -95,48 +95,46 @@ return { }, -- snippets - vim.fn.has("nvim-0.10") == 1 - and { - "nvim-cmp", - dependencies = { - { - "garymjr/nvim-snippets", - opts = { - friendly_snippets = true, - }, - dependencies = { "rafamadriz/friendly-snippets" }, - }, + { + "nvim-cmp", + dependencies = { + { + "garymjr/nvim-snippets", + opts = { + friendly_snippets = true, }, - opts = function(_, opts) - opts.snippet = { - expand = function(item) - return LazyVim.cmp.expand(item.body) - end, - } - table.insert(opts.sources, { name = "snippets" }) + dependencies = { "rafamadriz/friendly-snippets" }, + }, + }, + opts = function(_, opts) + opts.snippet = { + expand = function(item) + return LazyVim.cmp.expand(item.body) end, - keys = { - { - "", - function() - return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - { - "", - function() - return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" - end, - expr = true, - silent = true, - mode = { "i", "s" }, - }, - }, } - or { import = "lazyvim.plugins.extras.coding.luasnip", enabled = vim.fn.has("nvim-0.10") == 0 }, + table.insert(opts.sources, { name = "snippets" }) + end, + keys = { + { + "", + function() + return vim.snippet.active({ direction = 1 }) and "lua vim.snippet.jump(1)" or "" + end, + expr = true, + silent = true, + mode = { "i", "s" }, + }, + { + "", + function() + return vim.snippet.active({ direction = -1 }) and "lua vim.snippet.jump(-1)" or "" + end, + expr = true, + silent = true, + mode = { "i", "s" }, + }, + }, + }, -- auto pairs { @@ -168,11 +166,6 @@ return { "folke/ts-comments.nvim", event = "VeryLazy", opts = {}, - enabled = vim.fn.has("nvim-0.10") == 1, - }, - { - import = "lazyvim.plugins.extras.coding.mini-comment", - enabled = vim.fn.has("nvim-0.10") == 0, }, -- Better text-objects diff --git a/lua/lazyvim/plugins/compat/nvim-0_9.lua b/lua/lazyvim/plugins/compat/nvim-0_9.lua new file mode 100644 index 00000000..2962c97c --- /dev/null +++ b/lua/lazyvim/plugins/compat/nvim-0_9.lua @@ -0,0 +1,8 @@ +return { + { import = "lazyvim.plugins.extras.coding.luasnip" }, + { + "folke/ts-comments.nvim", + enabled = false, + }, + { import = "lazyvim.plugins.extras.coding.mini-comment" }, +} diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index ac84b743..207fd7fa 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -75,7 +75,7 @@ return { -- mason = false, -- set to false if you don't want this server to be installed with mason -- Use this to add any additional keymaps -- for specific lsp servers - ---@type LazyKeysSpec[] + -- ---@type LazyKeysSpec[] -- keys = {}, settings = { Lua = { diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 87b11fb7..8b4b2ec9 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -12,9 +12,18 @@ local prios = { } ---@type string[] -Config.json.data.extras = LazyVim.dedup(Config.json.data.extras) +local extras = LazyVim.dedup(Config.json.data.extras) -table.sort(Config.json.data.extras, function(a, b) +local version = vim.version() +local v = version.major .. "_" .. version.minor + +local compat = { "0_9" } + +if vim.tbl_contains(compat, v) then + extras[#extras + 1] = "lazyvim.plugins.compat.nvim-" .. v +end + +table.sort(extras, function(a, b) local pa = prios[a] or 10 local pb = prios[b] or 10 if pa == pb then @@ -26,4 +35,4 @@ end) ---@param extra string return vim.tbl_map(function(extra) return { import = extra } -end, Config.json.data.extras) +end, extras) diff --git a/lua/lazyvim/types.lua b/lua/lazyvim/types.lua index 73a5fe7b..52a340c9 100644 --- a/lua/lazyvim/types.lua +++ b/lua/lazyvim/types.lua @@ -1,4 +1,7 @@ +---@meta + ---@class LazyVimGlobals vim.g = {} _G.lazyvim_docs = true +_G.LazyVim = require("lazyvim.util") From c14d21ce7534ff302c1ccf0b22f46160ea98ccf1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jun 2024 09:05:16 +0200 Subject: [PATCH 28/34] feat: moved neoconf.nvim to extras --- lua/lazyvim/plugins/extras/dap/core.lua | 5 ----- lua/lazyvim/plugins/extras/lsp/neoconf.lua | 12 ++++++++++++ lua/lazyvim/plugins/lsp/init.lua | 5 ----- 3 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 lua/lazyvim/plugins/extras/lsp/neoconf.lua diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 77864460..06b8862d 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -81,11 +81,6 @@ return { }, }, }, - - -- VsCode launch.json parser - { - "folke/neoconf.nvim", - }, }, -- stylua: ignore diff --git a/lua/lazyvim/plugins/extras/lsp/neoconf.lua b/lua/lazyvim/plugins/extras/lsp/neoconf.lua new file mode 100644 index 00000000..4016816d --- /dev/null +++ b/lua/lazyvim/plugins/extras/lsp/neoconf.lua @@ -0,0 +1,12 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + { + "folke/neoconf.nvim", + cmd = "Neoconf", + opts = {}, + }, + }, + }, +} diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 207fd7fa..7e871a99 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -4,7 +4,6 @@ return { "neovim/nvim-lspconfig", event = "LazyFile", dependencies = { - { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, { "folke/neodev.nvim", opts = {} }, "mason.nvim", "williamboman/mason-lspconfig.nvim", @@ -119,10 +118,6 @@ return { end, ---@param opts PluginLspOpts config = function(_, opts) - if LazyVim.has("neoconf.nvim") then - require("neoconf").setup(LazyVim.opts("neoconf.nvim")) - end - -- setup autoformat LazyVim.format.register(LazyVim.lsp.formatter()) From 596c439db572c8b37c442a1f425b3f452607fd36 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jun 2024 09:33:19 +0200 Subject: [PATCH 29/34] feat(util): utility methods for lazy plugins --- lua/lazyvim/util/init.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 05d96db5..2417b597 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -57,9 +57,22 @@ function M.is_win() return vim.uv.os_uname().sysname:find("Windows") ~= nil end +---@param name string +function M.get_plugin(name) + return require("lazy.core.config").spec.plugins[name] +end + +---@param name string +---@param path string? +function M.get_plugin_path(name, path) + local plugin = M.get_plugin(name) + path = path and "/" .. path or "" + return plugin and (plugin.dir .. path) +end + ---@param plugin string function M.has(plugin) - return require("lazy.core.config").spec.plugins[plugin] ~= nil + return M.get_plugin(plugin) ~= nil end ---@param fn fun() From 5e76948d58d3ccae57b1cc09474a1f8b36d100ce Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jun 2024 09:33:52 +0200 Subject: [PATCH 30/34] feat(coding): use `lazydev.nvim` instead of `neodev.nvim` --- NEWS.md | 6 ++++++ lua/lazyvim/plugins/coding.lua | 22 ++++++++++++++++++++++ lua/lazyvim/plugins/compat/nvim-0_9.lua | 18 ++++++++++++++---- lua/lazyvim/plugins/lsp/init.lua | 1 - 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 72882791..05a1ddce 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,12 @@ ## 11.x +- **Neovim >= 0.10** now uses the much faster [lazydev.nvim](https://github.com/folke/lazydev.nvim) + instead of `neodev.nvim` + +- moved `neoconf.nvim` to extras. Project specific LSP settings + can be done with a `.lazy.lua` file instead. + - `mini.ai` is back as a default plugin! Removing it was a mistake. It's a great plugin that enhances the native text objects. diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index a3c91c3d..1f2cd7ae 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -200,4 +200,26 @@ return { } end, }, + + { + "folke/lazydev.nvim", + ft = "lua", + opts = function() + return { + library = { + uv = LazyVim.get_plugin_path("luvit-meta", "library"), + lazyvim = LazyVim.get_plugin_path("LazyVim"), + }, + } + end, + }, + -- Manage libuv types with lazy. Plugin will never be loaded + { "Bilal2453/luvit-meta", lazy = true }, + -- Add lazydev source to cmp + { + "hrsh7th/nvim-cmp", + opts = function(_, opts) + table.insert(opts.sources, { name = "lazydev", group_index = 0 }) + end, + }, } diff --git a/lua/lazyvim/plugins/compat/nvim-0_9.lua b/lua/lazyvim/plugins/compat/nvim-0_9.lua index 2962c97c..36394a72 100644 --- a/lua/lazyvim/plugins/compat/nvim-0_9.lua +++ b/lua/lazyvim/plugins/compat/nvim-0_9.lua @@ -1,8 +1,18 @@ +-- Compatibility with Neovim 0.9 return { + -- Use LuaSnip instead of native snippets { import = "lazyvim.plugins.extras.coding.luasnip" }, - { - "folke/ts-comments.nvim", - enabled = false, - }, + + -- Use mini.comment instead of ts-comments + { "folke/ts-comments.nvim", enabled = false }, { import = "lazyvim.plugins.extras.coding.mini-comment" }, + + -- Use neodev instead of lazydev + { "folke/lazydev.nvim", enabled = false }, + { + "neovim/nvim-lspconfig", + dependencies = { + { "folke/neodev.nvim", opts = {} }, + }, + }, } diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 7e871a99..1df5f728 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -4,7 +4,6 @@ return { "neovim/nvim-lspconfig", event = "LazyFile", dependencies = { - { "folke/neodev.nvim", opts = {} }, "mason.nvim", "williamboman/mason-lspconfig.nvim", }, From 6ba62855e24861d0187556af601ed81643aef7c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 2 Jun 2024 07:35:29 +0000 Subject: [PATCH 31/34] chore(build): auto-generate vimdoc --- doc/LazyVim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/LazyVim.txt b/doc/LazyVim.txt index 39d95790..63d911f6 100644 --- a/doc/LazyVim.txt +++ b/doc/LazyVim.txt @@ -1,4 +1,4 @@ -*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 01 +*LazyVim.txt* For Neovim >= 0.9.0 Last change: 2024 June 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* From b289fea1636eda08d82344dc32a114bca550e375 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Jun 2024 10:03:48 +0200 Subject: [PATCH 32/34] chore(main): release 12.3.0 (#3415) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5eb5ac9..7dadeb09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [12.3.0](https://github.com/LazyVim/LazyVim/compare/v12.2.0...v12.3.0) (2024-06-02) + + +### Features + +* **coding:** use `lazydev.nvim` instead of `neodev.nvim` ([5e76948](https://github.com/LazyVim/LazyVim/commit/5e76948d58d3ccae57b1cc09474a1f8b36d100ce)) +* **extras:** show extras imported in other extras ([b2858a2](https://github.com/LazyVim/LazyVim/commit/b2858a297a465546e9f34d5c3e9d42b9716048eb)) +* **extras:** split enabled in enabled plugins/languages ([45b92aa](https://github.com/LazyVim/LazyVim/commit/45b92aa381243417462fb4aac92478ce50b4e126)) +* moved neoconf.nvim to extras ([c14d21c](https://github.com/LazyVim/LazyVim/commit/c14d21ce7534ff302c1ccf0b22f46160ea98ccf1)) +* **util:** utility methods for lazy plugins ([596c439](https://github.com/LazyVim/LazyVim/commit/596c439db572c8b37c442a1f425b3f452607fd36)) + + +### Bug Fixes + +* **dot:** added dot to recommended ([c69553e](https://github.com/LazyVim/LazyVim/commit/c69553e1942a646917c92f3643a2ca78eeb19adf)) +* **json:** added *.json to recommended ([c98fbef](https://github.com/LazyVim/LazyVim/commit/c98fbef3b56fe6ba709254cdc90c8c46c078d555)) +* **util:** make sure doc gen works ([c33d657](https://github.com/LazyVim/LazyVim/commit/c33d6578a8b2ce03cab58d5952d717064125ef5d)) + ## [12.2.0](https://github.com/LazyVim/LazyVim/compare/v12.1.0...v12.2.0) (2024-06-01) From 6da95ee7d35f7eab4297c2229d8d79d43f5d12bc Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jun 2024 12:30:51 +0200 Subject: [PATCH 33/34] fix(todo-comments): use trouble filters for showing only todo/fix/fixmes --- lua/lazyvim/plugins/editor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index bd59b52b..bfb05930 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -471,8 +471,8 @@ return { keys = { { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, - { "xt", "TodoTrouble", desc = "Todo (Trouble)" }, - { "xT", "TodoTrouble keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme (Trouble)" }, + { "xt", "Trouble todo", desc = "Todo (Trouble)" }, + { "xT", "Trouble todo filter = {tag = {TODO,FIX,FIXME}}", desc = "Todo/Fix/Fixme (Trouble)" }, { "st", "TodoTelescope", desc = "Todo" }, { "sT", "TodoTelescope keywords=TODO,FIX,FIXME", desc = "Todo/Fix/Fixme" }, }, From bb66618f1fc265c7a702f3d13d704ffbb1066178 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 2 Jun 2024 14:24:14 +0200 Subject: [PATCH 34/34] fix(lazydev): easier way of defining library plugin paths --- lua/lazyvim/plugins/coding.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index 1f2cd7ae..b39976e3 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -207,8 +207,8 @@ return { opts = function() return { library = { - uv = LazyVim.get_plugin_path("luvit-meta", "library"), - lazyvim = LazyVim.get_plugin_path("LazyVim"), + uv = "luvit-meta/library", + lazyvim = "LazyVim", }, } end,