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
## [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)

View file

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

View file

@ -91,7 +91,9 @@ return {
table.insert(cmd, string.format("--jvm-arg=-javaagent:%s", lombok_jar))
end
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.
project_name = function(root_dir)

View file

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

View file

@ -1,9 +1,20 @@
local fail = nil
if vim.fn.has("nvim-0.11.2") == 0 then
vim.api.nvim_echo({
fail = {
{ "LazyVim requires Neovim >= 0.11.2\n", "ErrorMsg" },
{ "For more info, see: https://github.com/LazyVim/LazyVim/issues/6421\n", "Comment" },
{ "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.cmd([[quit]])
return {}

View file

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

View file

@ -95,13 +95,14 @@ return {
-- indents
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
-- folds
if vim.tbl_get(opts, "folds", "enable") ~= false then
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "v:lua.LazyVim.treesitter.foldexpr()"
if LazyVim.set_default("foldmethod", "expr") then
LazyVim.set_default("foldexpr", "v:lua.LazyVim.treesitter.foldexpr()")
end
end
end,
})

View file

@ -304,4 +304,50 @@ function M.statuscolumn()
return package.loaded.snacks and require("snacks.statuscolumn").get() or ""
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