Merge branch 'main' into dev

This commit is contained in:
chuyanlong 2025-09-19 08:40:12 +08:00
commit e5f7adee11
9 changed files with 96 additions and 20 deletions

View file

@ -1,3 +1,3 @@
{ {
".": "15.1.0" ".": "15.1.1"
} }

View file

@ -1,5 +1,14 @@
# Changelog # Changelog
## [15.1.1](https://github.com/LazyVim/LazyVim/compare/v15.1.0...v15.1.1) (2025-09-18)
### Bug Fixes
* **core:** check for outdated nightly. See [#6458](https://github.com/LazyVim/LazyVim/issues/6458) ([cfac3c9](https://github.com/LazyVim/LazyVim/commit/cfac3c9a85526ad7406f9b246097a1ec4fa1a2c3))
* **lspconfig:** remove all usage of `lspconfig` ([36b4191](https://github.com/LazyVim/LazyVim/commit/36b41911ab90fe19505af306a31a5a699342d3c3))
* **lsp:** schedule_wrap setting up LSPs to work around root cause of [#6456](https://github.com/LazyVim/LazyVim/issues/6456). Fixes [#6456](https://github.com/LazyVim/LazyVim/issues/6456) ([75a3809](https://github.com/LazyVim/LazyVim/commit/75a3809e15a0ecff9adc46c6cd3aaac51d99b561))
## [15.1.0](https://github.com/LazyVim/LazyVim/compare/v15.0.3...v15.1.0) (2025-09-18) ## [15.1.0](https://github.com/LazyVim/LazyVim/compare/v15.0.3...v15.1.0) (2025-09-18)

View file

@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
---@class LazyVimConfig: LazyVimOptions ---@class LazyVimConfig: LazyVimOptions
local M = {} local M = {}
M.version = "15.1.0" -- x-release-please-version M.version = "15.1.1" -- x-release-please-version
LazyVim.config = M LazyVim.config = M
---@class LazyVimOptions ---@class LazyVimOptions

View file

@ -91,7 +91,9 @@ return {
table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar)) table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar))
end end
return { return {
root_dir = require("lspconfig.util").root_pattern(vim.lsp.config.jdtls.root_markers), root_dir = function(path)
return vim.fs.root(path, vim.lsp.config.jdtls.root_markers)
end,
-- How to find the project name for a given root dir. -- How to find the project name for a given root dir.
project_name = function(root_dir) project_name = function(root_dir)

View file

@ -26,14 +26,21 @@ return {
"reason", "reason",
"dune", "dune",
}, },
root_dir = function(bufnr, on_dir) root_markers = {
local util = require("lspconfig.util") function(name)
local fname = vim.api.nvim_buf_get_name(bufnr) return name:match(".*%.opam$")
--stylua: ignore end,
on_dir(util.root_pattern("*.opam", "esy.json", "package.json", ".git", "dune-project", "dune-workspace", "*.ml")( fname)) "esy.json",
"package.json",
".git",
"dune-project",
"dune-workspace",
function(name)
return name:match(".*%.ml$")
end, end,
}, },
}, },
}, },
}, },
},
} }

View file

@ -1,9 +1,20 @@
local fail = nil
if vim.fn.has("nvim-0.11.2") == 0 then if vim.fn.has("nvim-0.11.2") == 0 then
vim.api.nvim_echo({ fail = {
{ "LazyVim requires Neovim >= 0.11.2\n", "ErrorMsg" }, { "LazyVim requires Neovim >= 0.11.2\n", "ErrorMsg" },
{ "For more info, see: https://github.com/LazyVim/LazyVim/issues/6421\n", "Comment" }, { "For more info, see: https://github.com/LazyVim/LazyVim/issues/6421\n", "Comment" },
{ "Press any key to exit", "MoreMsg" }, { "Press any key to exit", "MoreMsg" },
}, true, {}) }
elseif vim.fn.has("nvim-0.12") == 1 and not vim.lsp.is_enabled then
fail = {
{ "LazyVim requires Neovim >= 0.11.2 or a recent Nightly\n", "ErrorMsg" },
{ "Your nightly is too old, please update to a more recent version.\n", "Comment" },
{ "Press any key to exit", "MoreMsg" },
}
end
if fail then
vim.api.nvim_echo(fail, true, {})
vim.fn.getchar() vim.fn.getchar()
vim.cmd([[quit]]) vim.cmd([[quit]])
return {} return {}

View file

@ -2,7 +2,7 @@ return {
-- lspconfig -- lspconfig
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile", "BufWritePre" }, event = "LazyFile",
dependencies = { dependencies = {
"mason.nvim", "mason.nvim",
{ "mason-org/mason-lspconfig.nvim", config = function() end }, { "mason-org/mason-lspconfig.nvim", config = function() end },
@ -118,7 +118,7 @@ return {
return ret return ret
end, end,
---@param opts PluginLspOpts ---@param opts PluginLspOpts
config = function(_, opts) config = vim.schedule_wrap(function(_, opts)
-- setup autoformat -- setup autoformat
LazyVim.format.register(LazyVim.lsp.formatter()) LazyVim.format.register(LazyVim.lsp.formatter())
@ -146,9 +146,9 @@ return {
-- folds -- folds
if opts.folds.enabled then if opts.folds.enabled then
LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer) LazyVim.lsp.on_supports_method("textDocument/foldingRange", function(client, buffer)
local win = vim.api.nvim_get_current_win() if LazyVim.set_default("foldmethod", "expr") then
vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()" LazyVim.set_default("foldexpr", "v:lua.vim.lsp.foldexpr()")
vim.wo[win][0].foldmethod = "expr" end
end) end)
end end
@ -256,7 +256,7 @@ return {
resolve("denols") resolve("denols")
resolve("vtsls") resolve("vtsls")
end end
end, end),
}, },
-- cmdline tools and lsp servers -- cmdline tools and lsp servers

View file

@ -95,13 +95,14 @@ return {
-- indents -- indents
if vim.tbl_get(opts, "indent", "enable") ~= false then if vim.tbl_get(opts, "indent", "enable") ~= false then
vim.bo[ev.buf].indentexpr = "v:lua.LazyVim.treesitter.indentexpr()" LazyVim.set_default("indentexpr", "v:lua.LazyVim.treesitter.indentexpr()")
end end
-- folds -- folds
if vim.tbl_get(opts, "folds", "enable") ~= false then if vim.tbl_get(opts, "folds", "enable") ~= false then
vim.wo.foldmethod = "expr" if LazyVim.set_default("foldmethod", "expr") then
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()" LazyVim.set_default("foldexpr", "v:lua.LazyVim.treesitter.foldexpr()")
end
end end
end, end,
}) })

View file

@ -304,4 +304,50 @@ function M.statuscolumn()
return package.loaded.snacks and require("snacks.statuscolumn").get() or "" return package.loaded.snacks and require("snacks.statuscolumn").get() or ""
end end
local _defaults = {} ---@type table<string, boolean>
-- Determines whether it's safe to set an option to a default value.
--
-- It will only set the option if:
-- * it is the same as the global value
-- * it's current value is a default value
-- * it was last set by a script in $VIMRUNTIME
---@param option string
---@param value string|number|boolean
---@return boolean was_set
function M.set_default(option, value)
local l = vim.api.nvim_get_option_value(option, { scope = "local" })
local g = vim.api.nvim_get_option_value(option, { scope = "global" })
_defaults[("%s=%s"):format(option, value)] = true
local key = ("%s=%s"):format(option, l)
if l ~= g and not _defaults[key] then
-- Option does not match global and is not a default value
-- Check if it was set by a script in $VIMRUNTIME
local info = vim.api.nvim_get_option_info2(option, { scope = "local" })
---@param e vim.fn.getscriptinfo.ret
local scriptinfo = vim.tbl_filter(function(e)
return e.sid == info.last_set_sid
end, vim.fn.getscriptinfo())
local by_rtp = #scriptinfo == 1 and vim.startswith(scriptinfo[1].name, vim.fn.expand("$VIMRUNTIME"))
if not by_rtp then
if vim.g.lazyvim_debug_set_default then
LazyVim.warn(
("Not setting option `%s` to `%s` because it was changed by a filetype plugin."):format(option, value),
{ title = "LazyVim", once = true }
)
end
return false
end
end
if vim.g.lazyvim_debug_set_default then
LazyVim.info(("Setting option `%s` to `%s`"):format(option, value), { title = "LazyVim", once = true })
end
vim.api.nvim_set_option_value(option, value, { scope = "local" })
return true
end
return M return M