chylex / IntelliJ-Inspection-Lens

IntelliJ platform plugin that shows errors, warnings, and other inspection highlights inline.
https://plugins.jetbrains.com/plugin/19678-inspection-lens
Mozilla Public License 2.0
51 stars 12 forks source link

Allow using tooltip's font instead of editor's font #23

Open lppedd opened 1 month ago

lppedd commented 1 month ago

Sometimes using the monospaced editor's font means longer messages, up to being impossible to read.
Using the tooltip's font will result in more compact inlays.

judison commented 1 month ago

The monospaced font made it somewhat indistinguishable from the code. I think user Ippedd means the visual like "usages" one in this screen: image I'm not sure, but..., a little bit smaller, maybe?

Another great thing would be make it clickable, opening the context actions on the error/warn message

chylex commented 1 month ago

The problem I have is that the UI font ends up vertically misaligned, which is ugly and distracting, and it looks like too much work to fix just for Inspection Lens inlays. There is no way to customize just the inlay font either. I think I'd rather report this to JB to improve first.

chylex commented 1 month ago

Another great thing would be make it clickable, opening the context actions on the error/warn message

I looked into this a while back with no luck, but I tried again and I have a prototype, but it needs access to private IntelliJ APIs.

lppedd commented 1 month ago

@chylex if it can reassure you, I've been using internal APIs for some hacks in my plugins since 2019, with minor adjustments during the years.

Regarding the tooltip font, as far as I know the vertical alignment on the editor's line is done automatically in recent releases. Worth a try imo.

chylex commented 1 month ago

The APIs I'm talking about are not internal, they are private.

The text baseline is aligned between the editor and inlay, but only because Inspection Lens already shifts it by one pixel. This is how it would look with UI font without any baseline adjustment:

image

Another issue is that the inlay font is always 1 size smaller. Depending on which fonts you use, that can range from ugly to unreadable; in Rider specifically, Code Vision inlays are so bad I opened an issue specifically for that.

chylex commented 1 month ago

With the baseline adjustment, the UI font doesn't look half-bad, but that's just on one computer with Windows fonts. I've seen rendering get wonky on high DPI monitors, especially Mac OS with Retina screens, and needed ugly workarounds for that in another project.