mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
feat(lsp): enable LSP folds when available
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user