mrlacey / ConstVisualizer

Visual Studio extension to show the values of constants where they are used
https://marketplace.visualstudio.com/items?itemName=MattLaceyLtd.ConstVisualizer
MIT License
24 stars 3 forks source link

Too much vertical displacement #6

Closed LaraSQP closed 2 years ago

LaraSQP commented 3 years ago

The screenshot says it all.

capture_001_04092021_074223

Since I hopefully have your attention, btw, thank you very, very much for developing this and other extensions and making them and their source code available to all.

mrlacey commented 3 years ago

Thanks for flagging this. Which version of Visual Studio are you seeing this on? and what font are you using?

LaraSQP commented 3 years ago

Visual Studio version: 16.11.1 ConstVisualizer version: 1.10 Font: DejaVu Sans Mono

I should have included the info in the original comment. Apologies.

mrlacey commented 3 years ago

Sorry for the delayed response. Recent illness has stopped me from working on anything but I hope to get to this eventually.

mrlacey commented 2 years ago

I've just added a new version (v1.14) that increases the space between the visualization and the line above. I've tested with a number of different fonts and now don't see a version of the issue shown above but I don't have the font mentioned to be able to test with that.


String Resource Visualizer has also been modified in an equivalent way too :)

LaraSQP commented 2 years ago

I have found the vs2020 update and it does increase the distance between the value and the line above.

However, what I meant is that there is too much vertical displacement between the value and the line below (and this still the case in the latest version).

In other words, my request was to put the value closer to the constant it decorates.

As it is, the values are always closer to the line above than to the line below and, to be honest, I fail to understand why.

You can see that easily in the image I provided in the first comment as well as in your own images in the main page.

screenshot

mrlacey commented 2 years ago

With the current spacing, I am relying on the information from the selected typeface to determine how much space to leave. In your example, it looks like the typeface you're using leaves (or needs, or allows for) a lot of space between the baseline and the descender line. This looks like unnecessary padding based on the characters shown in the image. With other fonts (like in the image below) even if there are parts of the glyph that use the full space of the Body height, they won't crash into each other. This was more of a concern in my original design than the inclusion of extra whitespace.

image

What I don't want to have to try and do is determine how much white space there will be between the text of the file and what I'm adding above and so dynamically adjust the space accordingly. That feels like it would be a complex and time-consuming process that would impact development effort and, potentially, the responsiveness of the code.

Instead, how about I add manual configuration options to allow you to tweak the spacing?
This will allow you to control the exact spacing to your requirements.

I'm thinking to add Top Padding and Bottom Padding options that take positive and negative integer values. These would be zero by default but could be changed. By making them positive integers you'd increase the spacing. By making them negative numbers you'd decrease the spacing.

Without implementing this and testing, I think setting Bottom Padding to "-2" or "-3" you'd get the behavior you desire. Does this sound like a suitable solution?

LaraSQP commented 2 years ago

Those options would be the bee's knees. Thank you.

mrlacey commented 2 years ago

I've just published v1.15 to the marketplace and it adds this functionality.

Default (current) behavior: image

And this is the new version, with bottom padding of "-4" image

Make the adjustments by going to Tools > Options > Const Visualizer image

Your mileage and experience will vary based on the fonts you use and if you have const values with descenders or other elements below the baseline. This means that using a negative "Bottom padding" value could end up with something like this where you can't see all of the "g" image


If you have any problems, comments, or suggestions please raise another issue. If you love it, please leave a rating/review or consider sponsorship :smile:

LaraSQP commented 2 years ago

Great