Bug 415847

Summary: LSP client starts broken LSP server in an infinite loop
Product: [Applications] kate Reporter: Louis Moureaux <m_louis30>
Component: syntaxAssignee: Mark Nauwelaerts <mark.nauwelaerts>
Status: RESOLVED FIXED    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 19.12.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Louis Moureaux 2020-01-03 17:14:52 UTC
SUMMARY

When the LSP server crashes or otherwise closes unexpectedly (eg the Python server when pyls isn't available), the LSP client plugin will try to restart it in a loop, causing error message to blink above the editor. This behavior persists even when the LSP plugin is disabled.

STEPS TO REPRODUCE
1. Make sure pyls isn't installed
2. Enable the LSP plugin
3. Open a Python file
4. (Optional: disable the LSP plugin)

OBSERVED RESULT

The warning "LSP Client: Server terminated unexpectedly: python3 -m pyls --check-parent-process" blinks above the editor.

Refreshing the document (F5) after disabling the LSP plugin fixes the blinking.

EXPECTED RESULT

A failure message appears after N unsuccessful attempts, prompting the user to install pyls.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon packages
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2

ADDITIONAL INFORMATION

Neither clangd nor pyls are present in the Neon repos.
Comment 1 Christoph Cullmann 2020-01-04 16:37:33 UTC
At least some limit to how often to try it would be useful.

Beside that, perhaps we could show the json snippet for the server, this should contain e.g. the url + command we try.
Comment 2 Mark Nauwelaerts 2020-01-04 22:36:20 UTC
Oops, this problem disappeared a bit from my radar/backlog :-(

Suggested approach makes sense, and will have a go/look at that soon.
Comment 3 Mark Nauwelaerts 2020-01-05 15:35:22 UTC
Git commit 952f82fa176baacaf07c1df50a1c1f259c26a66c by Mark Nauwelaerts.
Committed on 05/01/2020 at 15:10.
Pushed by mnauwelaerts into branch 'master'.

lspclient: avoid repeated restart of failing LSP server

M  +56   -9    addons/lspclient/lspclientservermanager.cpp

https://invent.kde.org/kde/kate/commit/952f82fa176baacaf07c1df50a1c1f259c26a66c
Comment 4 Mark Nauwelaerts 2020-01-05 15:35:26 UTC
Git commit 952f82fa176baacaf07c1df50a1c1f259c26a66c by Mark Nauwelaerts.
Committed on 05/01/2020 at 15:10.
Pushed by scmsync into branch 'master'.

lspclient: avoid repeated restart of failing LSP server

M  +56   -9    addons/lspclient/lspclientservermanager.cpp

https://commits.kde.org/kate/952f82fa176baacaf07c1df50a1c1f259c26a66c
Comment 5 Louis Moureaux 2020-01-05 15:51:49 UTC
Thank you!