Indentation Guides - Design advice


My new QMBASIC mode is coming along nicely. I’m beginning to look at features for phase 2.

One thing that I’ve wanted in various editors for many years is the indentation guidelines - vertical lines at each level of indentation.

for i = 1 to 50
     begin case
    |      case i = 10
    |     |    print 'it is 10'
    |     case i = 50
    |     |     print 'it is fifty'
    end case
next i

This is a very simple example. The power of this comes into play when you have many nested loops and they go on for a number of pages. This is extremely helpful for people like me with vision issues.

We do not wish to embed the pipe symbol inside the whitespace created by the indention. It would need to be done in the rendering phase when the line is re-displayed in the editor.

What we do know about the line is:
the indentation level as an integer
the number of spaces used at each level

The padding spaces is user-configurable to their preferences. I like 4. So, each indentation level gets 4 spaces.

This information is available in the state object for each line.

What is the best approach?


There’s an implementation for Brackets (an editor based on CodeMirror) here, you might be able to get inspiration from that.