diff --git a/CHANGELOG.md b/CHANGELOG.md index d09e9482..7dadeb09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # 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) + + +### 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) 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/doc/LazyVim.txt b/doc/LazyVim.txt index 569245db..63d911f6 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 June 02 ============================================================================== Table of Contents *LazyVim-table-of-contents* 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/coding.lua b/lua/lazyvim/plugins/coding.lua index d143852f..b39976e3 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 @@ -207,4 +200,26 @@ return { } end, }, + + { + "folke/lazydev.nvim", + ft = "lua", + opts = function() + return { + library = { + uv = "luvit-meta/library", + lazyvim = "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 new file mode 100644 index 00000000..36394a72 --- /dev/null +++ b/lua/lazyvim/plugins/compat/nvim-0_9.lua @@ -0,0 +1,18 @@ +-- Compatibility with Neovim 0.9 +return { + -- Use LuaSnip instead of native snippets + { import = "lazyvim.plugins.extras.coding.luasnip" }, + + -- 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/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" }, }, diff --git a/lua/lazyvim/plugins/extras/coding/copilot-chat.lua b/lua/lazyvim/plugins/extras/coding/copilot-chat.lua index 8cd0e2d1..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 = "+CopilotChat (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", 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/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", 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" } }, 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/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, 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/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, 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, + }, +} diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index f9e841a8..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, @@ -119,12 +130,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, }, }, @@ -153,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 dfc1d2f7..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,41 +18,29 @@ 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 = { - 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", - "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 = 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/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/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 = { diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 414bb655..1df5f728 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -4,8 +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", }, @@ -75,7 +73,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 = { @@ -119,10 +117,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()) @@ -284,19 +278,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/ui.lua b/lua/lazyvim/plugins/ui.lua index 94d72a12..6f371351 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, }, @@ -315,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. diff --git a/lua/lazyvim/plugins/xtras.lua b/lua/lazyvim/plugins/xtras.lua index 6c789b0f..8b4b2ec9 100644 --- a/lua/lazyvim/plugins/xtras.lua +++ b/lua/lazyvim/plugins/xtras.lua @@ -5,15 +5,25 @@ 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, } ---@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 @@ -25,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") diff --git a/lua/lazyvim/util/extras.lua b/lua/lazyvim/util/extras.lua index 9cae88e4..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, @@ -225,7 +236,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" }) @@ -253,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 diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index c36ef101..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() @@ -72,6 +85,27 @@ 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 +---@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] + t[k] = t[k] or {} + if type(t) ~= "table" then + return + end + t = t[k] + end + return vim.list_extend(t, values) +end + ---@param name string function M.opts(name) local plugin = require("lazy.core.config").spec.plugins[name] @@ -198,4 +232,32 @@ 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 +---@param opts? { warn?: boolean } +function M.get_pkg_path(pkg, path, opts) + 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 = 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 + 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 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 = {