Bug 499092

Summary: LSP tooltip occasionally obscures context menu
Product: [Applications] kate Reporter: Grósz Dániel <groszdanielpub>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: REOPENED ---    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 24.12.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot
Screenshot in 25.04.1

Description Grósz Dániel 2025-01-24 14:37:47 UTC
Created attachment 177645 [details]
Screenshot

SUMMARY
If I right-click an indentifier ~exactly when the tooltip is about to show up, the tooltip sometimes appears on top of the context menu.

If I right-click the identifier after moving the mouse over it faster than the tooltip delay, it shows the context menu normally.

If I right-click after the tooltip is shown, the tooltip goes away, and the context menu is opened normally.

However, if I right-click (I think) almost exactly as much after hovering the identifier as the tooltip delay, the tooltip appears on top of the context menu, and some of the context menu items are hard or impossible to see or click. In this state the only way to make the tooltip go away is to click away and then open the context menu again. I never manage to intentionally reproduce it, but it happens accidentally perhaps about once in a few hours of coding. I guess it may happen when I right-click after the tooltip delay passes, but before the LSP server responds, at which point the tooltip is shown.

It's been occasionally happening ever since LSP tooltips were implemented.

STEPS TO REPRODUCE
0. Open a file supported by an LSP server that provides tooltips for identifiers.
1. Right-click an identifier very little more than the tooltip delay after hovering it. (I'm not 100% sure that's the condition, but that's what I suspect.)

OBSERVED RESULT
With a small chance, the tooltip obscures part of the context menu. (See screen photo – it's difficult to make a screenshot in this state.)

EXPECTED RESULT
Once the context menu is opened, the tooltip doesn't get shown, or disappears if it's already been shown. Alternatively, the context menu appears on top of the tooltip.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20250108
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.12.6-1-default (64-bit)
Graphics Platform: X11
Comment 1 Christoph Cullmann 2025-01-25 23:11:01 UTC
We could connect to the context menu event of the view and hide the tooltip if that is fired.
Comment 2 Grósz Dániel 2025-01-25 23:24:57 UTC
(In reply to Christoph Cullmann from comment #1)
> We could connect to the context menu event of the view and hide the tooltip
> if that is fired.

Actually if the tooltip is already open, it gets closed, so perhaps it should just also cancel any pending tooltip request.
Comment 3 Bug Janitor Service 2025-01-25 23:42:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/778
Comment 4 Christoph Cullmann 2025-01-25 23:43:52 UTC
Could you try if that patch helps?
Comment 5 Waqar Ahmed 2025-01-27 06:12:07 UTC
Git commit 2bb6ac5c1bdbc89f807c1c976fee8bd25887fbba by Waqar Ahmed, on behalf of Christoph Cullmann.
Committed on 27/01/2025 at 06:06.
Pushed by waqar into branch 'master'.

avoid text hint if already triggered when popup menu is requested

M  +3    -0    src/view/kateviewinternal.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/2bb6ac5c1bdbc89f807c1c976fee8bd25887fbba
Comment 6 Grósz Dániel 2025-06-16 11:52:03 UTC
Created attachment 182302 [details]
Screenshot in 25.04.1

(In reply to Christoph Cullmann from comment #4)
> Could you try if that patch helps?

Sorry I didn't have time to compile it from source back then, but as of 25.04.1 it still happens.