feline.nvim icon indicating copy to clipboard operation
feline.nvim copied to clipboard

E542: Unbalanced groups

Open caenrique opened this issue 2 years ago • 6 comments

I have this error from time to time, and I can't figure out why

E5108: Error executing lua ...e/pack/packer/start/feline.nvim/lua/feline/generator.lua:517: E542: unbalanced groups
stack traceback:
        [C]: in function 'nvim_eval_statusline'
        ...e/pack/packer/start/feline.nvim/lua/feline/generator.lua:517: in function 'get_component_width'
        ...e/pack/packer/start/feline.nvim/lua/feline/generator.lua:609: in function <...e/pack/packer/start/feline.nvim/lua/feline/generator.lua:526>

Do you have any idea about the source of the problem?? my configs can be found here

Originally posted by @caenrique in https://github.com/feline-nvim/feline.nvim/discussions/292

caenrique avatar Sep 12 '22 12:09 caenrique

The link to your config is broken

ram02z avatar Sep 13 '22 11:09 ram02z

Sorry, I updated the link to a public repository 😅 here is the link as well

caenrique avatar Sep 15 '22 10:09 caenrique

can you comment out components one by one until you find out which component is causing this

famiu avatar Sep 15 '22 11:09 famiu

I think it's related with this component (coming from nvim-metals) which is text coming from a global variable and is has variable lenght. My guess is that when this texts doesn't fit, it crashes.

caenrique avatar Sep 16 '22 11:09 caenrique

I managed to isolate a generated statusline string that make vim.api.nvim_eval_statusline fail:

"%#StatusComponent_CDD6F4_313244_NONE#Compiling subscriptions 5s (0%)%#StatusComponent_NONE_313244_NONE# "

posibly because of the % sign?

caenrique avatar Oct 03 '22 15:10 caenrique

I'm guessing that the provider string has unescaped % characters which can mess things up. You should probably escape those %s manually in that case

famiu avatar Oct 03 '22 16:10 famiu

I was seeing the same errors (also from nvim-metals statuses) and was able to escape the '%' escape character successfully (from lua) with s:gsub("[%%]", "%%%1") - you might need to escape # in that line as well, like s:gsub("[%%%#]", "%%%1").

kcsapp avatar Oct 04 '22 18:10 kcsapp

Closing this as it is not a Feline issue.

famiu avatar Oct 05 '22 09:10 famiu