Bug 467322 - LSP: show regular tooltip alongside error/warning
Summary: LSP: show regular tooltip alongside error/warning
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 22.12.3
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-14 09:52 UTC by Grósz Dániel
Modified: 2023-04-01 11:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Tooltip with warning only (9.90 KB, image/png)
2023-03-14 09:52 UTC, Grósz Dániel
Details
Regular tooltip (after using the variable) (9.26 KB, image/png)
2023-03-14 09:53 UTC, Grósz Dániel
Details
VS Codium showing both (showing that the server provides both) (11.49 KB, image/png)
2023-03-14 09:53 UTC, Grósz Dániel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Grósz Dániel 2023-03-14 09:52:33 UTC
Created attachment 157264 [details]
Tooltip with warning only

The LSP plugin can show tooltips hovering over identifiers, such as the type of a variable. Also, when hovering over code with an error or warning, it shows the message in a different kind of tooltip. However, the tooltip containing the error message *replaces* the regular tooltip; if a variable is in a part of the code that results in a warning, one can't see the tooltip containing the type of the variable, even when it would still be meaningful, and it's still provided by the language server.

A common occurrence where this is a problem is when I define a new variable with an automatically deduced type (in Typescript, but it could also be C++), and I'd like to see the deduced type, the language server immediately warns me that it's unused, and so I can't view the deduced type until I use the variable.

I suggest showing a tooltip that contains both the regular tooltip (e.g. the type of a variable) and the error message when possible.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20230312
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.1-1-default (64-bit)
Graphics Platform: X11
Comment 1 Grósz Dániel 2023-03-14 09:53:04 UTC
Created attachment 157265 [details]
Regular tooltip (after using the variable)
Comment 2 Grósz Dániel 2023-03-14 09:53:44 UTC
Created attachment 157266 [details]
VS Codium showing both (showing that the server provides both)
Comment 3 Bug Janitor Service 2023-03-31 21:44:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1176
Comment 4 Christoph Cullmann 2023-04-01 11:47:15 UTC
Git commit 16399c76ed83fe48037479f3a0b12618e5b5355a by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 01/04/2023 at 11:46.
Pushed by cullmann into branch 'master'.

Intoduce KateTextHintManager

KateTextHintManager provides centralized async interface to show
text hints. It uses KTextEditor::TextHintInterface::textHint() to know
when a text hint it is requested. It then sends a request to all
providers to create text hint and send it back when the text hint is
ready. This allows us to show information from multiple sources inside
one tooltip and avoids that everyone has to implement a provider and
manage it from scratch.

M  +0    -1    addons/lspclient/CMakeLists.txt
M  +25   -24   addons/lspclient/lspclienthover.cpp
M  +8    -4    addons/lspclient/lspclienthover.h
M  +10   -66   addons/lspclient/lspclientpluginview.cpp
M  +2    -0    apps/lib/CMakeLists.txt
M  +9    -58   apps/lib/diagnostics/diagnosticview.cpp
M  +3    -5    apps/lib/diagnostics/diagnosticview.h
M  +3    -1    apps/lib/katemainwindow.cpp
M  +14   -6    apps/lib/katemainwindow.h
A  +130  -0    apps/lib/texthint/KateTextHintManager.cpp     [License: LGPL(v2.0+)]
A  +64   -0    apps/lib/texthint/KateTextHintManager.h     [License: LGPL(v2.0+)]
R  +49   -13   apps/lib/texthint/tooltip.cpp [from: addons/lspclient/lsptooltip.cpp - 078% similarity]
R  +3    -6    apps/lib/texthint/tooltip.h [from: addons/lspclient/lsptooltip.h - 062% similarity]

https://invent.kde.org/utilities/kate/commit/16399c76ed83fe48037479f3a0b12618e5b5355a