Closed anonimo0-0 closed 10 months ago
-- Option 2: nvim lsp as LSP client
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
for _, ls in ipairs(language_servers) do
require('lspconfig')[ls].setup({
capabilities = capabilities
-- you can add other fields for setting up lsp server in this table
})
end
require('ufo').setup()
I've implemented Option 2 as suggested here but I'm still missing the closing bracket in my Rust projects. Is there something else I need to be doing?
Lazy config:
{
"kevinhwang91/nvim-ufo",
dependencies = {
"kevinhwang91/promise-async",
{
"luukvbaal/statuscol.nvim",
config = function()
local builtin = require("statuscol.builtin")
require("statuscol").setup({
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
},
})
end,
},
},
config = function()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local language_servers = require("lspconfig").util.available_servers()
for _, ls in ipairs(language_servers) do
require("lspconfig")[ls].setup({
capabilities = capabilities,
})
end
require("ufo").setup()
end,
},
Neovim version (nvim -v | head -n1)
NVIM v0.9.1
Operating system/version
Arch Linux
How to reproduce the issue
This is my config
Expected behavior
When I fold code, the closing parenthesis should remain visible, like the preview in your README![image](https://github.com/kevinhwang91/nvim-ufo/assets/107505515/c8739d6a-da5d-40bc-9c88-72e0b112e2c1)
Actual behavior
The closing parenthesis is hidden:
Only the opening one is visible.