nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.71k stars 455 forks source link

E539: Illegal character <,> #1201

Open rickalex21 opened 4 months ago

rickalex21 commented 4 months ago

Self Checks

How to reproduce the problem

Using fzf.vim with ripgrep when this line of code is in the config causes the error. The commented out line does not cause the error:

" let spec = {'options': ['--phony', '--query', query, '--bind', 'change:reload:'.reload_command]}
    let spec = {'options': ['--preview-window','up,75%,border-bottom,+{2}+3/3,~3','--phony', '--query', query, '--bind', 'change:reload:'.reload_command]}
    call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), fullscreen)

Expected behaviour

No errors

Actual behaviour

It's giving an error about a comma. Not sure what lualine has to do with fzf? A lot of it mentions nvim_win_set_option and vim.schedule.

Error executing vim.schedule lua callback: ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character <,>             
stack traceback:                                                                                                                                   
        [C]: in function 'nvim_win_set_option'                                                                                                     
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: in function 'setter_fn'                                                    
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:50: in function 'set_opt'                                                      
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:74: in function 'set'                                                          
        ...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:432: in function 'refresh'                                                     
        ...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:353: in function <...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:3
52>                           
Press ENTER or type command to continue                                                                                                            
Error executing vim.schedule lua callback: ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character <,>             
stack traceback:                                                                                                                                   
        [C]: in function 'nvim_win_set_option'                                                                                                     
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: in function 'setter_fn'                                                    
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:50: in function 'set_opt'                                                      
        ...vim/plugged/lualine.nvim/lua/lualine/utils/nvim_opts.lua:74: in function 'set'                                                          
        ...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:432: in function 'refresh'                                                     
        ...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:353: in function <...itchie/.config/nvim/plugged/lualine.nvim/lua/lualine.lua:3
52>    
sudomyju commented 3 months ago

I don't use fzf, but I have the bug as well, it started to pop up after configuring in bufferline.nvim to second lualine.

This is the usual pattern in logs after the lualine become absolutely useless ...

Error executing vim.schedule lua callback: ...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character < >
stack traceback:
        [C]: in function 'nvim_win_set_option'
        ...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: in function 'setter_fn'
        ...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:50: in function 'set_opt'
        ...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:74: in function 'set'
        ...e/su/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:432: in function 'refresh'
        ...e/su/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:353: in function <...e/su/.local/share/nvim/lazy/lualine.nvim/lua/lualine.lua:352>
Error executing vim.schedule lua callback: ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: lualine: Failed to refresh statusline:
...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character < >
stack traceback:
        [C]: in function 'error'
        ...share/nvim/lazy/lualine.nvim/lua/lualine/utils/utils.lua:211: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
sudomyju commented 3 months ago

is there some way to restart lualine and perhaps some easy way to debug it?

LordMZTE commented 2 months ago

I also managed to reproduce this with a custom component, but it's not consistent unfortunately. I'm unsure what exactly causes it.

Update: I've found out that this is caused by an invalid percent escape sequence such as %, being returned by a component. This means that I believe this to be a bug in the implementation of the respective component.

gukz commented 1 week ago

still suffer from this, as a result I remove all lualine addon

liangkarl commented 4 days ago

I also managed to reproduce this with a custom component, but it's not consistent unfortunately. I'm unsure what exactly causes it.

Update: I've found out that this is caused by an invalid percent escape sequence such as %, being returned by a component. This means that I believe this to be a bug in the implementation of the respective component.

Also suffer from this. In my case, it's pretty easy, nearly 100%, to reproduce for openning htm or js files.

liangkarl commented 4 days ago

Once I remove lsp-status, it would be back to normal

@@ -34,7 +34,7 @@ return { -- Status line (button)
         lualine_a = { 'mode' },
         lualine_b = { 'branch', 'diff', 'diagnostics' },
         lualine_c = { 'filename' },
-        lualine_x = { 'searchcount', "require('lsp-status').status()", 'encoding', 'fileformat', 'filetype' },
+        lualine_x = { 'searchcount', 'encoding', 'fileformat', 'filetype' },
         lualine_y = { 'progress' },
         lualine_z = { 'location' }
       },

If I print out the string of "require('lsp-status').status()" where it reports errors, it looks like this (XHR.poll('<%=REQUEST_URI%>') callback)

matched with the error msg Error executing vim.schedule lua callback: ...e/nvim/lazy/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character <>>

The WA for me is like this...

require('lsp-status').status():gsub("%%", "")