3 ms·
I’ve always wanted something like this extension, but where the brackets aren’t colorized, but rather change size depending on their nesting level, with the out
by derefr 5y ago
I’ve always wanted something like this extension, but where the brackets aren’t colorized, but rather change size depending on their nesting level, with the outermost brackets becoming increasingly large as the total nesting level of the expression increases — exactly the way brackets do in maths.
Ideally, unlike in TeX, additions to nesting levels wouldn’t require a re-flow (i.e. typing a bracket wouldn’t make the code constantly shimmy around on the screen), but rather these would just be changes in the perceived size of these characters, while keeping them where they are on a monospace grid (since a lot of code assumes a pure monospace layout for indentation et al.)
In my imagination, this would work by just having a set of bracket/paren/brace/etc. graphemes in each font, that have increasingly-long ascenders/descenders, while the base size of of the “functional” part of the grapheme remains constant. As if there were five versions of the letter g, with an increasing length of the stem on which the lower hook rests.
As such, these magnified brackets would be rendered similarly to the way emoji are rendered in terminals: the grapheme would eventually “leak out” of its monospace box (in the emoji case to the sides; in this case above and below), to the point of eventually overlapping surrounding graphemes, rather than re-spacing the text to give it room.
- rory 5y agoThe challenge here would be that nesting levels can be added inside or outside the previous level, so to prevent reflow, bracket size would be dependent on order of addition and could vary wildly between different "nests".
- snovv_crash 5y agoYou could just adjust the height, not width of the bracket. There is usually plenty of space between lines to support this.
- cscharenberg 5y agoI have a strong memory of using an IDE that behaved like this - using size and font to communicate structure - at a job around 2005. I can't currently remember the name but think it it started with 'source'? If someone else remembers this and the name I'd appreciate it. I could be remembering wrong too about how far it went with such decoration.
- pacaro 5y agoSourceInsight
- alexfoxgill 5y agothat probably wouldn't be sufficient to instantly grasp which bracket in a set of five opening brackets corresponded to its closing bracket. humans are not great at visually assessing minor differences in absolute size
- AaronFriel 5y agoUsing the "Custom CSS" extension you can do this. It looks like the bracket colorization is applied via CSS styles, via classes: bracket-highlighting-1 ... bracket-highlighting-6 unexpected-closing-bracket