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

Continuation Lines #16

Closed cimofj2 closed 3 years ago

cimofj2 commented 3 years ago

Is there any way to recognize Continuation Lines? I am having to use the 'Wrong indentation color" & 1st Indent color to get something reasonable. Also, The 2nd Indent color winds up not showing, when this is done & I'd like to get the 'Wrong indentation color" back!

marcelwgn commented 3 years ago

Thank you for creating this issue! This is definitely possible to implement, however it's more difficult than just filtering white spaces. I assume that the correct behavior would be to "extend" the coloring of the main line into the lines below that have been wrapped?

So in the image below, the red chunk would essentially be the same colors as the line above: image

In addition to that, error detection should be skipped for wrapped lines as they are not "real" intendation, for example when wrapping after "=" where a lot of people have a whitespace.

This is scenario is definitely not something that I have thought about, thank you for bringing my attention to it!

cimofj2 commented 3 years ago

There are probably a "list" of things that people put continuations on! I know I personally use "_" in VB Code; there's also "{" "}" "[" "]" "(" ")" (any brace pair) "=" (any operator) "," and almost anywhere (from some code I've seen). I would think "Intellisence" has to figure it out somehow.

marcelwgn commented 3 years ago

Ohhhh I think we were talking about two completely separate things here. What I thought you meant was something like this:

image

The continuation you are talking about is this, right:

Dim a As Integer
a = 500 _
  + 80 _
  + 90

In that case, unfortunately, it's beyond the scope of the extension do detect what a continued line is, and what is not a continued line.

marcelwgn commented 3 years ago

WIth further investigation, I also noticed that the first behavior I linked will be very difficult to get right and will definitely decrease the performance of parsing. I am very sorry that I won't be able to help with the continuation, I currently how to even approach those continuation lines. Another user I talked to (who also uses this extension and continuation lines) just disabled the indentation error display.

Would something like this help with continuation lines: image

If so, feel free to reopen this issue, and I'll start working on that.

cimofj2 commented 3 years ago

Where I worked (25yrs Dupont +10yrs EDS Sparrows Point, MD), we were taught NOT TO BE THAT "CUTE" & other things. However, I can't say I haven't "cleaned" that type of code. If that was a bunch of long named variables I might do that if and only if it made it clearer. I know there HAS TO BE a reasonable limit! I would just say use some form of judgement. 80/20 is what I go by. Anything can have a "creep" point.

marcelwgn commented 3 years ago

If there doesn't seem to be interest in that kind of feature, there isn't much benefit in me adding it then.