-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Neovim version (nvim -v | head -n1)
NVIM v0.11.0-dev-1050+g45e319ade
Operating system/version
Kubuntu 24.04
How to reproduce the issue
When I start the debug session and the cursor is (and it is by default) on the beginning of the first line of the document which also contains a fold I get a error message.
Note that issue does not appear if I navigate from and back to same position.
Example to reproduce:
/*
* foo bar
*/
fn main() {
let string = "Hüllo, world!\nHello, world!\nHello, world!";
for l in string.lines() {
println!("- {} -\n", l);
}
let end = string.chars().take(5).map(|c| c.len_utf8()).sum();
println!("{} {}", &string[..end], end);
}
My config:
function()
-- lsp->treesitter->indent
local ftMap = {
vim = 'indent',
python = { 'indent' },
git = '',
}
---@param bufnr number
---@return Promise
local function customizeSelector(bufnr)
local function handleFallbackException(err, providerName)
if type(err) == 'string' and err:match 'UfoFallbackException' then
return require('ufo').getFolds(bufnr, providerName)
else
return require('promise').reject(err)
end
end
return require('ufo')
.getFolds(bufnr, 'lsp')
:catch(function(err) return handleFallbackException(err, 'treesitter') end)
:catch(function(err) return handleFallbackException(err, 'indent') end)
end
---@type UfoConfig
---@diagnostic disable: missing-fields
return {
filetype_exclude = { 'help', 'alpha', 'dashboard', 'neo-tree', 'Trouble', 'lazy', 'mason' },
provider_selector = function(_, filetype, _) return ftMap[filetype] or customizeSelector end,
close_fold_kinds_for_ft = {
default = { 'imports', 'comment' },
},
open_fold_hl_timeout = 800,
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
local hlgroup = 'NonText'
local newVirtText = {}
local suffix = ' ' .. tostring(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, { suffix, hlgroup })
return newVirtText
end,
}
end
Expected behavior
No error
Actual behavior
Error detected while processing OptionSet Autocommands for "buftype":
E5248: Invalid character in group name
Press ENTER or type command to continue
Error detected while processing OptionSet Autocommands for "buftype":
Error executing lua callback: ....local/share/nvim/lazy/nvim-ufo/lua/ufo/model/window.lua:56: E474: Invalid argument
stack traceback:
[C]: in function '__newindex'
....local/share/nvim/lazy/nvim-ufo/lua/ufo/model/window.lua:56: in function 'removeListOption'
....local/share/nvim/lazy/nvim-ufo/lua/ufo/model/window.lua:150: in function 'clearCursorFoldedLineHighlight'
...oo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:159: in function 'resetCurosrFoldedLineHighlightByBuf'
...oo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/decorator.lua:383: in function 'listener'
...oo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/lib/event.lua:54: in function 'emit'
...n/.local/share/nvim/lazy/nvim-ufo/lua/ufo/bufmanager.lua:56: in function 'listener'
...oo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/lib/event.lua:54: in function 'emit'
...e/foo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/main.lua:67: in function <...e/foo/.local/share/nvim/lazy/nvim-ufo/lua/ufo/main.lua:51>
[C]: in function 'resume'
.../foo/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:118: in function 'step'
.../foo/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:150: in function 'run'
...oo/.local/share/nvim/lazy/nvim-dap-ui/lua/dapui/init.lua:223: in function 'update_render'
...oo/.local/share/nvim/lazy/nvim-dap-ui/lua/dapui/init.lua:320: in function 'c'
.../foo/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1060: in function <.../foo/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1048>
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working