facelessuser / BracketHighlighter

Bracket and tag highlighter for Sublime Text
https://facelessuser.github.io/BracketHighlighter/
1.75k stars 245 forks source link

Inconsistent highlight with multple brackets in a row #629

Closed dexusnl closed 7 months ago

dexusnl commented 7 months ago

If a couple of successive brackets are used (like happens a lot in lisp) the highlight is inconsistent. Below is the example 'code' that reads (((test)))

What happens when the cursor is moved over the brackets is shown below.

(((test)))
*--------^
-*------^-
--*----^--
--^----*--
--^-----*- incorrect
-^-------* incorrect

The expected results is that in the last 3 examples the opposite should happen from the first 3 examples.

facelessuser commented 7 months ago

If a couple of successive brackets are used (like happens a lot in lisp) the highlight is inconsistent.

On the contrary, the highlight is very consistent, it just isn't your preferred approach.

With bracket_outside_adjacent set to true (the default) BH will also highlight brackets when it is outside (not between) the bracket, and if between two brackets, it will favor the one on the left.

Screenshot 2024-03-01 at 6 11 57 AM Screenshot 2024-03-01 at 6 15 04 AM

It sounds like you expect the behavior of when this feature is turned off. If so, it will only highlight the brackets it is between. Sorry, the first image didn't capture the cursor when it was blinking.

Screenshot 2024-03-01 at 6 12 54 AM Screenshot 2024-03-01 at 6 15 26 AM
dexusnl commented 7 months ago

I see, thank you for the clarification. Works very well for me now.

Could be an idea to have this parameter set to false for formats like lisp, because there the default way doesn't make much sense.

facelessuser commented 7 months ago

I think it makes fine sense, but acknowledge that people will prefer one approach vs the other, hence the ability to set bracket style to a user's desired preference.

I think switching bracket convention per language would be confusing (to my brain at least), I much prefer consistency.

Currently, BH doesn't allow setting bracket conventions per language, I'm not saying I couldn't or wouldn't add such functionality, but if this is truly desired, a new issue should be opened with this request. If people seem to really want said feature, I would potentially consider it for the future.

I imagine most people just select the option that works well for their brain and never touch it again.