vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Inlay hints should show problems for the range in the hover

Open Tyriar opened this issue 3 years ago • 3 comments

Hovering inlay hints should show problems "underneath":

Recording 2022-01-11 at 12 42 26

Tyriar avatar Jan 11 '22 20:01 Tyriar

Came here to report the same thing

https://user-images.githubusercontent.com/8007967/165316556-6e10bcb9-3737-448f-bc73-09a88cb92773.mp4

jjspace avatar Apr 26 '22 13:04 jjspace

This happens because inlay hint have their own hover which are anchored on a ForeignElement. The diagnostics hover explicitly checks for that and bails out. @alexdima Would be OK to pretend to be a "normal" range hover anchor so that I can get all the hovers together? Or should the diagnostics hover not check for the hover type?

jrieken avatar Dec 08 '22 14:12 jrieken

@jrieken The HoverForeignElementAnchor is used both by inlay hints (via InlayHintsHoverAnchor) and ghost text (directly instantiates it). I think in the case of inlay hints you would want that markers are rendered in the hover, but perhaps ghost text wouldn't want that they appear in the hover, it might want to show only these actions:

image

My suggestion would be to add something to HoverForeignElementAnchor to be able to distinguish the two cases.

alexdima avatar Dec 08 '22 14:12 alexdima

Can still repro this

lramos15 avatar Jan 25 '23 18:01 lramos15

@Tyriar Please update this issue with a real code snippet that allows to reproduce this, @lramos15 please update this issue with what you have tried. Thanks

jrieken avatar Jan 26 '23 09:01 jrieken

@Tyriar Please update this issue with a real code snippet that allows to reproduce this, @lramos15 please update this issue with what you have tried. Thanks

I just found a reduce function in VS Code sources such as return this.viewItems.reduce((r, item) => r + item.minimumSize, 0); and replace the returned value with the void keyword such as return this.viewItems.reduce((r, item) => void, 0);

lramos15 avatar Jan 26 '23 13:01 lramos15

Something like this only gives a squiggle for the return value, not the arguments or anything with inline hints. To clarify, this will only work for squiggles that spawn across inline hints

let a = [1, 2, 3];
a.reduce((r, item) => void, 0);
Screenshot 2023-01-26 at 14 49 07

jrieken avatar Jan 26 '23 13:01 jrieken

Hmm, maybe it's because it's in a function so the return value becomes incorrect? This in splitview.ts

image

lramos15 avatar Jan 26 '23 14:01 lramos15

Thanks for updating

jrieken avatar Jan 26 '23 14:01 jrieken

Looks good to me.

Version: 1.75.0-insider Commit: acbbdaa41a459aab86072e8d97255cd2ea1d9529

image

aeschli avatar Jan 27 '23 09:01 aeschli