← Back to context

Comment by hyperrail

4 months ago

Font sizes and families are also a relatively little-used way to visually distinguish things in a code editor.

Years ago I used to work on C++ code in a commercial editor called Source Insight [1]. At its default settings, it would do things like:

1. Show function and class names in HUGE fonts in declarations and definitions, so you always knew what was a declaration as opposed to a use

2. Show nested parentheses with the outermost parens being biggest and getting smaller as you got further in

3. Show comments in a proportional sans-serif font instead of a monospaced one so that you could tell where the comments were even if you have color blindness

Those features, along with having a C++ parser and code relationship visualizer much faster than the Visual Studio of the day without having to parse ahead of time (a la ctags), made Source Insight a near standard in my company. I still miss it on occasion.

[1] https://www.sourceinsight.com/feature-details/

You could also use color intensity (faded or bolded or even fully desaturated), animated shrinking/growing font sizes as your cursor moves between code blocks to emphasize the important vs less important data, background coloring, colored box outlines surrounding related code, etc.

So many ways to focus attention and highlight related areas, but so few IDEs that do anything about it...

I remember Source Insight. It was one of those things that some people loved and others hated.

Re: comments in proportional font; while it's an interesting way to highlight them, the problem is that then precludes you from using ASCII art to diagram things in comments (or from reading such diagrams in existing codebases where they exist).

Still possible in VSCode through somewhat hackish methods (esp. arbitrary CSS injection via createTextEditorDecorationType). Here are some quick screenshots of random JS/Rust examples in my installation: https://imgur.com/a/LUZN5bl

  • This is one of those things where both extremes of madness and genius wrap around to infinity and meet again.

I have independently discovered the benefit of (3), having comments (prose) in a proportional font. I think I'll also enjoy (2) too. I'll see how to configure it for my editor.