oderwat / vscode-indent-rainbow

Extension which shows indentation with a faint rainbow colored background to make them more readable
MIT License
406 stars 53 forks source link

ignoreAlignmentSpaces - an option to make this extension perfectly suit those who use tabs for indentation and spaces for alignment #143

Open xaxazak opened 1 year ago

xaxazak commented 1 year ago

I like this extension a lot but my code does have many sections of imperfect highlighting. An example might be:

int some_func(int num)
    {
        return
              another_func(num) // *** This line shows error (or wrong highlights if using ignoreLinePatterns) ***
            + yet_other_func(num)
            + some_long_constant;
    }

I align like this for readability, eg if the equation gets too long.

But tabs for indentation and spaces for alignment is a common style guideline (first google hit of many). This option provides highlighting that perfectly suits this style.

This is a fairly trivial change, the functionality (1 line) is simply to use a different value for regEx if this option is set, but adding an option required a few more lines.

The ignoreLinePatterns option helps, but doesn't solve all the issues that this does (eg, it still either highlights alignment spaces as if they were indents or errors).

I added a readme entry, hopefully it's clear enough.

Previously I submitted a suggestion relating to this. (and I took the hint :))


I've been fixing a few of my annoyances with vscode recently to get it fitting perfectly (also added settings to vscode for always indenting empty lines and minimum autocomplete characters) but this is my first pull request, so please tell me if I'm doing anything wrong.