Lint tooltips can cover range text of diagnostic #1704

Closed
opened 2026-05-15 19:26:01 +02:00 by push-f.com · 3 comments

When the text annotated by a diagnostic covers multiple lines (either logical lines or visual lines with EditorView.lineWrapping) the displayed hover tooltip can cover the annotated text:

image

image

image

Which I think is generally not what you'd want. I'd expect the tooltip to displayed below the relevant text.

sandbox link

When the text annotated by a diagnostic covers multiple lines (either logical lines or visual lines with `EditorView.lineWrapping`) the displayed hover tooltip can cover the annotated text: ![image](/attachments/4ebad85f-fbd3-4221-bc28-b5f381a63529) ![image](/attachments/c620303c-1784-4c0b-9419-3428c0aecd2f) ![image](/attachments/4204e66c-ce80-444a-ab84-17f53df21459) Which I think is generally not what you'd want. I'd expect the tooltip to displayed below the relevant text. [sandbox link](https://codemirror.net/try/#c=aW1wb3J0IHtzeW50YXhUcmVlfSBmcm9tICJAY29kZW1pcnJvci9sYW5ndWFnZSIKaW1wb3J0IHtsaW50ZXIsfSBmcm9tICJAY29kZW1pcnJvci9saW50IgoKY29uc3QgcmVnZXhwTGludGVyID0gbGludGVyKHZpZXcgPT4gewogIGxldCBkaWFnbm9zdGljcyA9IFtdCiAgc3ludGF4VHJlZSh2aWV3LnN0YXRlKS5jdXJzb3IoKS5pdGVyYXRlKG5vZGUgPT4gewogICAgaWYgKG5vZGUubmFtZSA9PSAiVGVtcGxhdGVTdHJpbmciKSBkaWFnbm9zdGljcy5wdXNoKHsKICAgICAgZnJvbTogbm9kZS5mcm9tLAogICAgICB0bzogbm9kZS50bywKICAgICAgc2V2ZXJpdHk6ICJ3YXJuaW5nIiwKICAgICAgbWVzc2FnZTogImZvbyIsCiAgICB9KQogIH0pCiAgcmV0dXJuIGRpYWdub3N0aWNzCn0pCgppbXBvcnQge2Jhc2ljU2V0dXAsIEVkaXRvclZpZXd9IGZyb20gImNvZGVtaXJyb3IiCmltcG9ydCB7amF2YXNjcmlwdH0gZnJvbSAiQGNvZGVtaXJyb3IvbGFuZy1qYXZhc2NyaXB0IgppbXBvcnQge2xpbnRHdXR0ZXJ9IGZyb20gIkBjb2RlbWlycm9yL2xpbnQiCgpuZXcgRWRpdG9yVmlldyh7CiAgZG9jOiAnYEZvb1xuQmFyYFxuXG5gSGFjIGFjIGNvbnNlcXVhdCwgY29uZGltZW50dW0gYSwgYW1ldCBmdXNjZSBjb252YWxsaXMgZG9uZWMgYWxpcXVhbSBpbnRlZ2VyIG5lcXVlLiBDb25kaW1lbnR1bSBpbmNlcHRvcyBzYXBpZW4gcnV0cnVtLCBhZW5lYW4gY29uc2VjdGV0dXIgdWx0cmljZXMgZmFjaWxpc2lzIGNyYXMuYCcsCiAgZXh0ZW5zaW9uczogWwogICAgYmFzaWNTZXR1cCwKICAgIEVkaXRvclZpZXcubGluZVdyYXBwaW5nLAogICAgamF2YXNjcmlwdCgpLAogICAgbGludEd1dHRlcigpLAogICAgcmVnZXhwTGludGVyCiAgXSwKICBwYXJlbnQ6IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIiNlZGl0b3IiKSB8fCBkb2N1bWVudC5ib2R5Cn0pCg==)
push-f.com changed title from Lint tooltips can cover text range of diagnostic to Lint tooltips can cover range text of diagnostic 2026-05-15 19:29:56 +02:00
Owner

Does making lint tooltips show above their target position, the way VS Code does it, sound like an acceptable solution to you?

Does making lint tooltips show above their target position, the way VS Code does it, sound like an acceptable solution to you?
Author

Yes I think so. Huh interestingly VS Code shows it not above the first line but above the hovered line. Zed does show it above the first line. I think above the first line is nicer since then it doesn't cover any of the lines in the range (especially when the tooltips are shown by pressing F8, for which VS Code and Zed have their widgets). It will however need some additional logic for when the starting line is scrolled out of view.

Yes I think so. Huh interestingly VS Code shows it not above the first line but above the hovered line. Zed does show it above the first line. I think above the first line is nicer since then it doesn't cover any of the lines in the range (especially when the tooltips are shown by pressing <kbd>F8</kbd>, for which VS Code and Zed have their widgets). It will however need some additional logic for when the starting line is scrolled out of view.
Owner

Attached patch implements this.

Attached patch implements this.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/dev#1704
No description provided.