feat(lsp): enable LSP folds when available

This commit is contained in:
Folke Lemaitre
2025-09-17 08:11:33 +02:00
parent 4a3b4a80a8
commit 5e2c4e62f2

View File

@@ -45,6 +45,12 @@ return {
codelens = {
enabled = false,
},
-- Enable this to enable the builtin LSP folding on Neovim.
-- Be aware that you also will need to properly configure your LSP server to
-- provide the folds.
folds = {
enabled = true,
},
-- add any global capabilities here
capabilities = {
workspace = {
@@ -137,6 +143,14 @@ return {
end)
end
-- 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()"
end)
end
-- code lens
if opts.codelens.enabled and vim.lsp.codelens then
LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer)