indentation guides

I’m working on indentation guides in the codemirror 6 and I have an implementation that works well(ish).

It uses the Decoration.mark at various indents.
so If I have an indent of 8 on a particular line.
I might include an indent mark at range 0, 4 and 4, 8. (offset by line.from)

But indentation marks should also be visible on empty lines when it’s part of indentation block.
With the Decoration.mark I can’t put those on empty lines so I’m a bit stuck.

Any suggestions much appreciated!

Does putting a widget decoration holding the styled spaces at the end of lines that aren’t long enough work?

1 Like

Perfect - thanks @marijn - just what I was looking for. Works great.

@stu Would you be willing to share your code for indentation guides? I’m looking to implement something similar.

@mgmeyers

here is my implement.
Hope to help you.

@mgmeyers sorry for the delay - needed to check whether I was able to share the code - and because of the holidays it took a while to get the all clear.

Below is our python indentation guides extension.
We only show the second level indentation or greater (easily changed to show the first one).
We also don’t do any highlighting of the current indentation guide (like vs code might - though that might not be too difficult to add).

1 Like

Thanks for releasing this @stu! I’m going to adapt this for Nota and you’ve saved me a lot of time :slight_smile: