rafamel/subtle-brackets

Feature resquest: closest brackets are continuously highlighted

g-berthiaume opened this issue · 3 comments

Currently, the brackets will be highlighted only if your cursor is next to one of the bracket.
An option to keep the closest bracket pair highlighted while your cursor is inside them, would be nice.

Example:

              my cursor is here
              v
if (FrameworkUnitTest() == false) ApplicationFatalError();
   ^                            ^
   This is highlighted          This is highlighted     

Thanks;
Great extension.

Would be nice to have this feature optional via config to have opportunity to disable it

I'll try to have this for the next release, but I'm not sure it'll make it. But anyhow if it does it will be disabled by default @Zx-EvM

Hi @Zx-EvM . After giving this some thought, I will not be implementing this for now, so I'll be closing the issue.

Implementing this would change the behavior for the left hand side brackets. As it is right now, if no bracket is found on the right side, the extension will look for the adjacent character on the left side, and decorate it even if it is a closing bracket. Having this would mean we'd have to discard left hand closing brackets decoration, as we'd go for the brackets the cursor is surrounded with. For that reason it's a feature we'd need to have as optional -so not on by default from the start- for that alternate behavior.

In case you'd like to submit a PR for it, this should get implemented in the form of Paper.getAdjacent() returning the ILineMatch for the opening or closing bracket the cursor is in, even if it's not adjacent.