madskristensen / RainbowBraces

A Visual Studio extension
Apache License 2.0
132 stars 7 forks source link

Sometime coloring of random characters #28

Open biobshub opened 1 year ago

biobshub commented 1 year ago

When editing a code file (.cs, or javascript) , after some changes the extension is not only coloring brackets, but also random characters in any words. after saving the file the coloring is normal again.

it is hard to describe how to reproduce, because it happens randomly. very often after automated refactoring or cut/paste code blocks.

system is VS 2022 17.3.4 with latest Resharper tools.

madskristensen commented 1 year ago

I cannot reproduce this with the latest version 1.0.37, but I did see it in an earlier version. Can you verify that the issue still reproduces for you on the version 1.0.37 or if it can be closed as fixed?

biobshub commented 1 year ago

yes, it happens on version 1.0.37. because the occurrence is so randomly, i still cannot give a hint how to reproduce it. last time it happened after automatic refactoring/renaming a c# class.

btw. thanks for the tool, it is very useful.

bmadtiger commented 1 year ago

Just happened to me on a fresh install after editing the parameter list of a method: image Also note the nesting levels of the brackets are out of sync (see also #31).

NB Scrolling refreshes the screen and resolves the issue.

gnimor commented 1 year ago

I can see the same behaviour here - also after a fresh install without any other extension installed.

twoelfer commented 1 year ago

I see the same random-colored letters problem with 1.0.37.. What i also see: When some letters are displayed in a random color and i simply scroll down and up again (the letters do not need to go offscreen), the correct color is used.

menees commented 1 year ago

This happened to me today using 1.0.37. Glitches like this have happened to me enough that I'm uninstalling the extension. I can do things to force it to repaint, but that's more annoying than living with normal braces. :-(

In this screenshot the W in consoleWidth, the c in IsOutputRedirected, and the h in maxMessageWidth were all painted incorrectly.

image

My immediately preceding edits to the code changed the first line from:

(Console.IsOutputRedirected ? int.MaxValue : Console.WindowWidth) - 1

to

Console.IsOutputRedirected ? int.MaxValue : (Console.WindowWidth - 1)

So, moving the opening and closing parentheses (in that order) made the extension lose its mind. It would be better if the extension didn't do any painting when the parentheses are temporarily unbalanced than to have it start coloring random non-parentheses/brace/bracket characters.

get-flat commented 1 year ago

Another scenario: correcting function definition with quick actions (no parenthesis editing, adding/removing)

Before: private void SomeFunction(MyType type) After: Use VS Quick Actions to fully qualify MyType name i.e. MyClass.MyType (after quick actions applied: private void SomeFunction(MyClass.MyType type) results in random characters coloring (not only in this line). Scrolling through code helps

Version 1.0.40

sholman commented 1 year ago

I'm seeing this on version 1.0.40 as well.