izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.46k stars 214 forks source link

Colorization of If-else levels is broken #174

Open Alexsey opened 6 years ago

Alexsey commented 6 years ago

Your programming language

JavaScript

Expected Behavior

if, consequent if else and final else should be considered as having the same level

Talking in terms of colors on the screenshot, the parenthesizes of (a), (b) and (c) should have the same color and parenthesizes of f(), g(), h() and q() should have the same color

Current Behavior

Every if else is considered as nested to the preceding if or if else. Final else is considered as the same level as preceding if else

Talking in terms of colors on the screenshot, the parenthesizes of (a), (b) and (c) have different colors and parenthesizes of f(), g(), h() have different colors

For some strange reason, parenthesizes of f() has the same color as (b) and g() has the same color as (c)

Code snippet for reproduce (for bugs)

let [a, b, c] = [true, true, true]
let [f, g, h, q] = [() => {}, () => {}, () => {}, () => {}]

if (a) {
  f()
} else if (b) {
  g()
} else if (c) {
  h()
} else {
  q()
}

Your Environment

WebStorm 2018.3 EAP
Build #WS-183.2153.10, built on September 5, 2018
WebStorm EAP User
Expiration date: October 5, 2018
JRE: 1.8.0_152-release-1293-b10 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

rb-if-else

izhangzhihao commented 6 years ago

Same behavior with java:

if (true) {
     System.out.println();
} else if (true) {
     System.out.println();
} else if (true) {
     System.out.println();
} else {
     System.out.println();
}

image

GenhaoLi commented 3 years ago

still a problem now

ris58h commented 2 years ago

I have the same issue with try-catch blocks. I have Cycle count on all brackets option turned on.

Screenshot 2022-10-12 at 12 58 02
izhangzhihao commented 1 year ago

This might finally be fixed.

image
Alexsey commented 1 year ago

As for the latest version 2023.1.0, it doesn't look fixed:

With Cycle count on all brackets: enabled Screenshot 2022-12-29 at 19 10 10 Screenshot 2022-12-29 at 19 10 42
With Cycle count on all brackets: disabled Screenshot 2022-12-29 at 19 31 41 Screenshot 2022-12-29 at 19 30 41
izhangzhihao commented 1 year ago

Yep, because the fix is not verified and added to the current release, for now, I still need some time to verify to not break other features.

Alexsey commented 11 months ago

@izhangzhihao for the sake of consistency, this issue may also have the "from paid user" badge. I'm with you from the start =)