manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.36k stars 197 forks source link

outdated diagnostic #901

Closed sawyerzheng closed 2 months ago

sawyerzheng commented 3 months ago

After lsp-bridge run for a long time. Sometimes, the diagnostic still dispaly there, even though the error is fixed and the lsp-bridge-diagnostic-list is empty.

image

manateelazycat commented 3 months ago

Can you give me test code?

sawyerzheng commented 3 months ago

Cannot give example code, because this behavior will disappear if I restart lsp-bridge or restart emacs.

This is a long existing problem, I fix it by restart lsp-bridge-restart-process every time. The best way to fix it to kill the buffer and to reopen it, as sometimes lsp-bridge-restart-process also not work.

It exists on arch linux, ubuntu 20.04 and wsl arch linux for emacs 29

manateelazycat commented 3 months ago

When the lsp server has diagnostic information, it will call https://github.com/manateelazycat/lsp-bridge/blob/dfabfc818c688b38fce8c09323bd8ed9bcdd011f/core/lspserver.py#L603

Then lsp-bridge will call https://github.com/manateelazycat/lsp-bridge/blob/dfabfc818c688b38fce8c09323bd8ed9bcdd011f/core/fileaction.py#L303

Then call https://github.com/manateelazycat/lsp-bridge/blob/dfabfc818c688b38fce8c09323bd8ed9bcdd011f/core/fileaction.py#L317

Finally call https://github.com/manateelazycat/lsp-bridge/blob/dfabfc818c688b38fce8c09323bd8ed9bcdd011f/lsp-bridge-diagnostic.el#L185 to update the overlay of diagnostic information

Can you add print logs in the above places to see which function stopped when reproducing? As long as we can find the conditional judgment of the error, we can completely solve this problem.

manateelazycat commented 2 months ago

@sawyerzheng

The diagnostic function should be developed first, and the hybrid multi-server function should be developed later.

The reason for diagnostic confusion is that when multiple LSP Servers are working at the same time (such as Python's default multi-server), different LSP Servers return diagnostic information at different times. If a Ticker is shared, the diagnostic information of some LSP Servers will be incorrectly discarded instead of being sent to Emacs to update diagnostic information.

Just update to the latest version