Bug 492076 - LSP plugin output from rust-analyzer has incorrect syntax highlighting
Summary: LSP plugin output from rust-analyzer has incorrect syntax highlighting
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 24.08.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-23 12:23 UTC by Adam Fontenot
Modified: 2024-08-23 18:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot of the issue (67.28 KB, image/png)
2024-08-23 12:23 UTC, Adam Fontenot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Fontenot 2024-08-23 12:23:58 UTC
Created attachment 172874 [details]
screenshot of the issue

Incidentally, it might be useful if we had a lsp-plugin component for reporting issues. Maybe a Bugzilla admin could add one?

SUMMARY

If you hover over a String type in Kate, you get broken syntax highlighting in the output. (Same for most other types with extensive documentation.)

Have a look at https://doc.rust-lang.org/1.80.1/src/alloc/string.rs.html to see the raw documentation that is supposed to be shown.  The portions of the documentation that are code are clearly delineated in the source by backticks - this is a Markdown variant.

I'm not sure if it's possible to debug language server responses within Kate, but my reading of the spec is that responses to "hover information" requests are supposed to be Markdown documents, so my guess is that Kate is receiving something more-or-less exactly like what is shown in the raw Rust language documentation.

This means that Kate must be failing to parse the Markdown correctly since it's applying syntax highlighting to the wrong elements.

rust-analyzer 2024-08-19 (v0.3.2078)

STEPS TO REPRODUCE
1. Hover over the word "String" (representing a Rust std String) in a document with the rust-analyzer server enabled for the LSP plugin

OBSERVED RESULT

See summary.

Operating System: Arch Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Waqar Ahmed 2024-08-23 13:08:20 UTC
yup, this is a known issue.
Comment 2 Bug Janitor Service 2024-08-23 13:36:30 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1564
Comment 3 Waqar Ahmed 2024-08-23 13:42:38 UTC
Git commit 39d7e06a6d571426202eeaec80ddfd085b784f39 by Waqar Ahmed.
Committed on 23/08/2024 at 13:35.
Pushed by waqar into branch 'master'.

Tooltip: Only highlight blocks that are marked BlockCodeLanguage

M  +28   -4    apps/lib/texthint/tooltip.cpp

https://invent.kde.org/utilities/kate/-/commit/39d7e06a6d571426202eeaec80ddfd085b784f39
Comment 4 Waqar Ahmed 2024-08-23 18:24:07 UTC
Git commit e223796258b309b6cbde2ed018c9d4976abcd885 by Waqar Ahmed.
Committed on 23/08/2024 at 18:21.
Pushed by waqar into branch 'release/24.08'.

Tooltip: Only highlight blocks that are marked BlockCodeLanguage
(cherry picked from commit 39d7e06a6d571426202eeaec80ddfd085b784f39)

M  +28   -4    apps/lib/texthint/tooltip.cpp

https://invent.kde.org/utilities/kate/-/commit/e223796258b309b6cbde2ed018c9d4976abcd885