mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 04:21:08 +00:00
feat(lsp): enable LSP folds when available
This commit is contained in:
parent
4a3b4a80a8
commit
5e2c4e62f2
1 changed files with 14 additions and 0 deletions
|
|
@ -45,6 +45,12 @@ return {
|
||||||
codelens = {
|
codelens = {
|
||||||
enabled = false,
|
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
|
-- add any global capabilities here
|
||||||
capabilities = {
|
capabilities = {
|
||||||
workspace = {
|
workspace = {
|
||||||
|
|
@ -137,6 +143,14 @@ return {
|
||||||
end)
|
end)
|
||||||
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
|
-- code lens
|
||||||
if opts.codelens.enabled and vim.lsp.codelens then
|
if opts.codelens.enabled and vim.lsp.codelens then
|
||||||
LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer)
|
LazyVim.lsp.on_supports_method("textDocument/codeLens", function(client, buffer)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue