-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SOLVED]
RPC[Error] code_name = InternalError, message = "Request textDocument/foldingRange failed with message: Cannot read properties of undefined (reading 'lineFoldingOnly')"
#912
Comments
This is one is gonna be tough to debug because it doesn't reproduce consistently, give me more time to debug. |
It's not bug of You can see configuration of LSP capabilities in https://github.com/kevinhwang91/nvim-ufo/tree/main#minimal-configuration (option 2), or in my config dynamotn/neovim-config@e7fa4ca |
I can confirm what @dynamotn said andthat's works for me: local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
} |
For those using Mason: local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
require("mason-lspconfig").setup_handlers {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities,
}
end,
["yamlls"] = function()
require("lspconfig").yamlls.setup {
capabilities = capabilities,
settings = {
yaml = {
schemas = {
kubernetes = "/*.yaml",
-- Add the schema for gitlab piplines
-- ["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*.gitlab-ci.yml",
},
},
},
}
end,
}
|
I can confirm that silence the warnings. |
[SOLVED]
RPC[Error] code_name = InternalError, message = "Request textDocument/foldingRange failed with message: Cannot read properties of undefined (reading 'lineFoldingOnly')"
I took a look at this after I looked at #807 since I think they might have the same root cause (missing a null check somewhere while reading in the settings). However, I wasn't able to reproduce this in Helix, since it doesn't support folding nor configuring the client capabilities that are sent to the server. In order to reproduce this issue, I'll need to go through setting up folding support for neovim in order to reproduce this issue. (For anyone whose interested in reproducing, note that neovim doesn't support folding ranges out of the box, and you will need to use a plugin or code it yourself in lua in order to enable it). |
For those that still have this issue even after applying the fix, check if you have yaml-companion, {
"someone-stole-my-name/yaml-companion.nvim",
ft = { "yaml" },
dependencies = {
{ "neovim/nvim-lspconfig" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
},
opts = {
lspconfig = {
capabilities = {
textDocument = {
foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
},
},
},
},
},
} |
Describe the bug
When using
yaml-language-server
from mason, writing a .yaml buffer causes the error:Expected Behavior
No errors on write
Current Behavior
Error on write
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: