Skip to content
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

E539: Illegal character <i> when opening neovide code base with rust analyzer #98

Closed
linrongbin16 opened this issue Nov 7, 2023 · 15 comments

Comments

@linrongbin16
Copy link
Owner

image

It may relate to #95 .

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

it seems an issue from lualine, reported here: nvim-lualine/lualine.nvim#1136.


confirmed it's not.

@linrongbin16
Copy link
Owner Author

image

based on vim doc, vim.pesc() could escape all the lua pattern characters, it is the root cause of this issue, the wrong characters are: <d>, <+>, etc.

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

hi @cuducos , we should only replace the % char to %%, not use vim.pesc() API.

I submit #101 to fix this.

since I'm not expert on ruby, would you please help confirm if this PR can work correctly in your project?


I refactored the client_format in #103 , it should be a better default formatter for both lua and vim string formatting.

@cuducos
Copy link
Contributor

cuducos commented Nov 7, 2023

we should only replace the % char to %%, not use vim.pesc() API.

My bad, sorry.

since I'm not expert on ruby, would you please help confirm if this PR can work correctly in your project?

Just tested, head is at af46da3 — all working beautifully! Thank you so much : )

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

My bad, sorry.

haha, don't be. thanks for your help!

@cuducos
Copy link
Contributor

cuducos commented Nov 7, 2023

I am sorry but it looks like I rushed into conclusions. This error is back later on… maybe it's not Ruby LSP, or it is a later update.

Error executing vim.schedule lua callback: vim/_editor.lua:0: nvim_exec2()..User Autocommands for "LspProgressStatusUpdated": Vim(append):Error executing lua callback: ...e/nvim/lazy/lualin
e.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character < >

I haven't had time to debug, but will try to do it later.

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

for short term solution, please configure it with your previous series_format via vim.pesc() API.

if you have any time, please set {debug=true, file_log=true} in the setup, and post the log here, looks like there's an unvisible whitespace character that crash the lualine.

@linrongbin16 linrongbin16 reopened this Nov 7, 2023
@linrongbin16
Copy link
Owner Author

I think you're right in the first PR, the Neovim statusline itself also format the percentage %.... I didn't really pay attention at first.

@cuducos
Copy link
Contributor

cuducos commented Nov 7, 2023

So, it looks like the we're not escaping the %… I see the value being sent by Lualine to be:

ERROR setting option statusline to: %#lualine_a_normal# NORMAL %#lualine_transitional_lualine_a_normal_to_lualine_b_normal#%#lualine_b_normal#  sdp-migration/low-install-checks-to-prod %#lualine_transitional_lualine_b_normal_to_lualine_c_filetype_DevIconRb_normal#%<%#lualine_c_filetype_DevIconRb_normal# %#lualine_c_normal# ruby %#lualine_c_normal#%#lualine_c_normal#  app/jobs/trust_automation/install_check_ingestion_job.rb %#lualine_c_normal#%=%#lualine_c_normal#  LSP [ruby_ls] ⣷ Ruby LSP: indexing files 100% completed (100%%) - done %#lualine_c_normal#  %#lualine_c_normal# utf-8 %#lualine_transitional_lualine_a_normal_to_lualine_c_normal#%#lualine_a_normal#   6:1  %#lualine_a_normal# 16%% 

Again we have one unescaped % in Ruby LSP: indexing files 100% completed (100%%)

I see #103 removed the gsub from series_format and has not included it into client_format — was that intentional?

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

in #103 , I was thinking we don't need to double the % chars, so I removed it.

because in client_format I removed the string.format API here: https://github.com/linrongbin16/lsp-progress.nvim/pull/103/files#diff-cac8a6172f06fbcdb207c376794e53c7dbf871846e643ecd5448c16f75444278L116. which will render/consume 1 % from %%.

instead I use .. to append string, so the lsp progress content should not be modified.

@cuducos
Copy link
Contributor

cuducos commented Nov 7, 2023

Hum… got it! Yes, we might need it, I guess. Because (as far as I got) the % has is a special character for Neovim's statusline, winbar etc.

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Nov 7, 2023

oh I got it, so we really need to double the % chars.

just like the string.format("(%.0f%%%%)", percentage), it will:

  1. lua string.format will render the last 4 %%%% to %%.
  2. in Neovim statusline, it will render the 2 %% to 1 %.

@linrongbin16
Copy link
Owner Author

@cuducos would you please help test on this branch: fix-percentage-again ( #105 ) ?

@cuducos
Copy link
Contributor

cuducos commented Nov 7, 2023

Tested. Works like a charm ✨

@linrongbin16
Copy link
Owner Author

really thank you for working with my on this issue! I merged it to main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants