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

Invalid Event "User LspProgressStatusUpdated" #94

Closed
dreamerlzl opened this issue Oct 17, 2023 · 12 comments · Fixed by #118
Closed

Invalid Event "User LspProgressStatusUpdated" #94

dreamerlzl opened this issue Oct 17, 2023 · 12 comments · Fixed by #118

Comments

@dreamerlzl
Copy link

Rongbin, thank you for your work.

The Problem

Whenever I launch neovim, I will meet the following error:

Error detected while processing /home/wright/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/wright/.config/nvim/lua/core/statusline.lua:61: Invalid 'event': 'User LspProgressStatusUpdated'
stack traceback:
        [C]: in function 'nvim_create_autocmd'
        /home/wright/.config/nvim/lua/core/statusline.lua:61: in main chunk
        [C]: in function 'require'
        /home/wright/.config/nvim/init.lua:5: in main chunk

Environment

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794
@linrongbin16
Copy link
Owner

linrongbin16 commented Oct 17, 2023

Hi @dreamerlzl , from #78 , can you update your statusline config follow below (add pattern to autocmd API):

vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
vim.api.nvim_create_autocmd("User", {
  group = "lualine_augroup",
  pattern = "LspProgressStatusUpdated",
  callback = require("lualine").refresh,
})

@dreamerlzl
Copy link
Author

vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
vim.api.nvim_create_autocmd("User", {
  group = "lualine_augroup",
  pattern = "LspProgressStatusUpdated",
  callback = require("lualine").refresh,
})

That works like a charm. Thank you so much for the instant reply!

@Integralist
Copy link

@linrongbin16 👋🏻

I was having this issue too and followed your advice and that helped fix it for Go.

But in Rust it starts out fine but then suddenly shows this error...

Screenshot 2024-02-07 at 13 54 42

Any ideas/suggestions ?

Thanks!

@linrongbin16
Copy link
Owner

linrongbin16 commented Feb 7, 2024

Hi @Integralist,

the reason is usually, the status message from lsp, cannot be correctly rendered in lualine.

It's usually bacause of the % escape issue. e.g. the error message Illigal character <<e2>>.

If you can always reproduce this issue, please enable debug and file_log. And upload the file log here, we need to find out what chars are causing this exception.

@linrongbin16 linrongbin16 reopened this Feb 7, 2024
@linrongbin16 linrongbin16 pinned this issue Feb 7, 2024
@Integralist
Copy link

Yup I can reproduce every time 🙂 I'll provide the details you need tomorrow. Thanks 👍

@Integralist
Copy link

@linrongbin16 here's the log... I'm not sure there's anything useful in it though 😬

2024-02-09 09:53:22.034 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:22.436 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Fetching metadata"
2024-02-09 09:53:22.639 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⢿ Fetching metadata"
2024-02-09 09:53:22.840 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⡿ Fetching metadata"
2024-02-09 09:53:22.942 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣯ Roots Scanned 31/98 (31%%), Fetching"
2024-02-09 09:53:22.999 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣯ Roots Scanned 46/98: /Users/integralist/.cargo/registry/src…"
2024-02-09 09:53:23.085 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣷ Roots Scanned 61/98: /Users/integralist/.cargo/registry/src…"
2024-02-09 09:53:23.248 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Roots Scanned 84/98 (85%%), Fetching metadata"
2024-02-09 09:53:23.363 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Roots Scanned 96/98: /Users/integralist/.rustup/toolchains/…"
2024-02-09 09:53:23.469 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Roots Scanned 96/98: /Users/integralist/.rustup/toolchains/…"
2024-02-09 09:53:23.731 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Roots Scanned 98/98 (100%%) - done, Fetching metadata (100%…"
2024-02-09 09:53:25.137 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣻ Roots Scanned 98/98 (100%%) - done, Fetching"
2024-02-09 09:53:25.148 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣯ Roots Scanned 98/98 (100%%) - done, Fetching metadata"
2024-02-09 09:53:26.587 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⡿ Roots Scanned 98/98 (100%%) - done, Building building proc-…"
2024-02-09 09:53:26.593 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Roots Scanned 98/98 (100%%) - done, Building building proc-…"
2024-02-09 09:53:26.622 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:26.730 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:26.978 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣷ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:26.995 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:27.114 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣷ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:27.295 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣾ Building building proc-macros: crs (100%%) - done, Indexing…"
2024-02-09 09:53:27.486 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣻ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:27.615 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⢿ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:27.779 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⡿ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:27.884 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⡿ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:27.994 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:28.086 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:28.383 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣷ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:28.583 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣾ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:28.784 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Indexing 10/11 (reqwest) (90%%)"
2024-02-09 09:53:28.984 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣻ Indexing 10/11 (reqwest) (100%%) - done"
2024-02-09 09:53:28.994 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣻ Indexing 10/11 (reqwest) (100%%) - done"
2024-02-09 09:53:29.118 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣻ Indexing 10/11 (reqwest) (100%%) - done"
2024-02-09 09:53:29.385 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⡿ Indexing 10/11 (reqwest) (100%%) - done"
2024-02-09 09:53:29.585 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣟ Indexing 10/11 (reqwest) (100%%) - done"
2024-02-09 09:53:29.883 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:29.994 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:30.083 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:30.283 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:30.621 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:30.871 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:30.996 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.121 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.127 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.156 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.190 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.224 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.259 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.294 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.326 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.490 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.621 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.743 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.776 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.810 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.844 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.878 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.912 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.951 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.978 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:31.997 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.012 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.062 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.099 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.121 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.126 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.157 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.191 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:32.624 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:33.000 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:33.046 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:33.123 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:33.626 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:34.000 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:34.008 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:34.129 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:34.181 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"
2024-02-09 09:53:34.487 [DEBUG]: |lsp-progress.progress| returned content: "rust-analyzer"

@linrongbin16
Copy link
Owner

linrongbin16 commented Feb 9, 2024

hi @Integralist,

yes it's useful.

Neovim statusline will escape the % char in text content. when you want to print % in statusline, you need to escape it with %%.

So you can see, in the log, when we want to show 100%, actually I am returning the text content 100%% from the progress api.

But in this line:

2024-02-09 09:53:23.731 [DEBUG]: |lsp-progress.progress| returned content: "[rust-analyzer] ⣽ Roots Scanned 98/98 (100%%) - done, Fetching metadata (100%…"

You can see the line is truncated, and the last chars are %..., it can be an invalid char for Neovim statusline.

I guess that's the exception.

Are you specifying the max_size in lsp-progress plugin?

@Integralist
Copy link

I'm not setting that. What would you recommend I set that to?

@Integralist
Copy link

To clarify you can see my config here...

https://github.com/Integralist/nvim/blob/main/lua/plugins/ui.lua

@linrongbin16
Copy link
Owner

hi @Integralist,

would you please try branch linrongbin16-patch-1? see if it's working.

@Integralist
Copy link

@linrongbin16 yup that branch fixes things 🙂

@linrongbin16
Copy link
Owner

linrongbin16 commented Feb 9, 2024

@linrongbin16 yup that branch fixes things 🙂

I will merge it later, now I am not in front of my keyboard (I edit this PR with my phone).


update: @Integralist , it's merged into main branch, please use main branch and try again.

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

Successfully merging a pull request may close this issue.

3 participants