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

Lines break up when word wrap is used #158

Closed mybearworld closed 1 year ago

mybearworld commented 1 year ago

Enable word wrap.

Expected behavior

the lines being joined

Actual behavior

the lines being broken up

oderwat commented 1 year ago

That is the expected and correct behavior, as there is no indentation in this line. I wonder how your "Expected behavior" image was created. If there is a regular line, it should have the lines with and without word wrap enabled. If it means that you expect that lines are drawn in the "middle" of the line, then that expectation is wrong. The plugin cares only about the start of the line. It was mostly made for Python, Nim, Haskell or Yaml. Which means, languages where the indentation of the start of the line matters.

mybearworld commented 1 year ago

VSCode will keep the indentation the same for word wrapped lines. image

if True:
    while True:
        print("This is a very long string that will get separated up by word wrap.")

While yes, this would theoretically mean in the middle of the line, visually it's the same line, and still the same indentation level. So it'd make sense to also mark it.

I wonder how your "Expected behavior" image was created.

Image editing.

oderwat commented 1 year ago

The indentation of the line can be by definition only at the start of the line. Your line continuation does not count as an indentation for this plugin.

Image editing.

Yeah, I figured that. My question was more related to the authority that decided about the "expected behavior". It is what you expect, and your expectation is wrong for what this plugin does. I believe I got a similar request before. But most of the 5.5 million installations seem to share my expectation (or don't care).

GBR6000 commented 1 year ago

@oderwat I personally would prefer the behaviour describe here. In #57 it makes sense to not colorize but this is different. I use the lines as an indicator of what range of code is going to get folded and so the colouring being non-continuous doesn't make sense to me. Also I think it looks worse. So an optional toggle might be nice. Obviously if it is needlessly complex to add due to the text wrapping not actually containing characters don't bother.

EDIT: To clarify in this mode the expected behaviour being the recoloration of the lines already present in VSCode by default is not strange. Notably these lines do continue during a text wrap.

mybearworld commented 1 year ago

It looks like the VSCode API doesn't actually support this. If they were to ever implement this, then this would be a great feature still.

oderwat commented 1 year ago

I would not want it even if the VSCode API could do something like that. This indentation is not relevant for the code functionality, and it would harm not to see that it actually is not the indentation of the line itself. I think people who actually were originally targeted with this: Python, Haskell, Nim, Yaml and the ones that I have forgotten would also not like it because it would make reading code harder. This plugin was never about "beauty" even if people like it for that (I suppose). It was created, so you can indent and check your "code indentation language" with less cognitive burden.

oderwat commented 1 year ago

Obviously if it is needlessly complex to add due to the text wrapping not actually containing characters don't bother.

If you make a PR I consider adding it as optional functionality. We had this before for other things I didn't need myself. I also cannot get tired of telling everybody and his dog, that, despite 5.6 million "installations" I got about 40 coffees from this.

mybearworld commented 1 year ago

I'd argue it's actually a functionality problem, as these are styled the exact same way as when indentation stops.