marcelwgn / IndentRainbow

Visual Studio extension for colorization of indent levels
https://marketplace.visualstudio.com/items?itemName=chingucoding.IndentRainbow
MIT License
32 stars 8 forks source link

Feature request: Add rainbow for new empty line with auto indents #27

Open Move2win opened 2 years ago

Move2win commented 2 years ago

Automatically add rainbow for new empty line who inherits an auto-indent param from the previous line.

Inked屏幕截图(751)_LI

marcelwgn commented 2 years ago

This is definitely a good idea. If you wish to contribute this feature, feel free to do so, I'm not sure when I will get to this.

marcelwgn commented 2 years ago

Could you share a document/example where this is the case? I found that Visual Studio inserts virtual indentation that is only render but does not exist in the actual text. If the line contains actual whitespaces or tabs, they should be colored correctly.

Move2win commented 1 year ago

Could you share a document/example where this is the case?

In this case, the visual studio cursor gives an auto-indent after pressing enter, but IndentRainbow does not react to this.

image

I found that Visual Studio inserts virtual indentation that is only render but does not exist in the actual text.

This should be why IndentRaimbow does not react to auto-indent creation by pressing enter. I found out that if I add a space at one of the ends of the auto-indent lines, the rainbow will appear even if I delete that space later, the rainbow will keep anyway.

Even that's the case. I found it very inconvenient to add and then delete space for every empty line to get them to show the rainbow. It would be great if it could be improved.

szalapski commented 11 months ago

I'd like to propose a "one step farther" variation: I'd like to see lines that are blank (only whitespace) should always show the same rainbow indent as the last previous non-whitespace line. For example, in move2win's screenshot above, lines 76-83 would all have the same rainbow colors as line 75, regardless of whether they are empty or have tabs or spaces.

I think it is okay to show these even though there are no space/tab characters "underneath" the proposed rainbow colors there because the goal of the extension is to show the structure of code, not to visualize space/tab characters.

marcelwgn commented 11 months ago

This is definitely a good idea, however implementation is probably not that easy since we would now need to store the indentation of the last line. Doable but not as easy as other features that have been added throughout the years 😅