Sublime Forum

BracketHighlighter

#113

Yes, it will be automatic…which is what I am a little worried about.

I imagine I am going to get a bunch of bug issues of “why is X not working like it used to”, “what happend to my shortcuts”, “where did my colors go”, “Why are my setting in BracketHighlighter.sublime-settings not working”. I am going to have probably a good couple weeks of a lot of people freaking out without reading the documentation. I wish I could get the messages.json working properly with my package in Package Control, but I never have figured it out.

So really if you are waiting for the official version, just sit tight and you will automatically get it. I wanted to get it nice and stable and ensure that my new design was not going to have negative effects before I pushed it out on people…but if your curious, it is working real nice :smile:.

I realize the new settings file(s) are a bit more complicated, but this allows custom brackets which people seemed so badly to want. The more flexibility that is desired, the more complicated the system. It saves me a great deal of trouble though, because now custom brackets can be added without me ever touching the core code…I can’t tell you how happy I am about that :smile:.

0 Likes

#114

The messages.json is a bit odd. I’ve noticed (at least before the update, but I assume it’s still the same), that the commit/version times are based on EST. I normally add a couple hours to the current time, then offset it to EST. It may be worth giving it a shot, since, as you said, may users will ask you why x,y, and z are not working anymore. In the worst case scenario, no one gets your message and you get all the issue creation you expect. In the best case, it works and people will (hopefully) read about the updates on the README. Setting up the messages themselves is pretty straight forward. I’m sure you have looked through the same documentation I have on wbond’s site.

Anyways, that’s my insight into the messages system of package control. I think it’s worth giving it a shot since, even though I’m sure you will answer the “why isn’t this working anymore questions”, you would be happier if you didn’t have to, or at least had fewer. Anyways, thanks for all the hard work (on this and your other plugins)!

0 Likes

#115

@skuroda thanks for the info, I will give it a try again, it has been a while since I have tried. I would be nice to get it working.

0 Likes

#116

Hi facelessuser

I’m using BracketHighlighter and it’s great!
However there are 2 problems I couldn’t solve.

  1. I’d like to make bracket bold when highlighted, so far I have foreground key in my colour scheme, but fontStyle key won’t work.
  2. Highlighting is fast when I move my cursor line by line, but when I move it without release and then stop, it takes about a second to make highlight.
    I tried editing the plugin core, but with no success. Are there any settings for that?

Thanks :smile:

0 Likes

#117
  1. This is a limitation in Sublime Text
  2. At most, it should be about half a second at most. Basically a match is requested on certain events like: when you move your cursor, when you edit, etc. But doing this can bog down the editor if it was actually done on every key press etc. So there is a system in place, for instance, when you are having a lot of key press events, BH will hold off on matching the brackets until the events slow down. So on these occasions when BH has entered into a mode where it is delaying the matching, you can get a delay when coming out of it. This is much better than the alternative.
0 Likes

#118

Hi Forum,

I’m having trouble updating BracketHighlighter through Package Control:

ST 2.0.1, Build 2217
Current Version of BH: v2012.10.01.02.30.26
Update offered by Package Control: v2013.03.27.09.00.08

Upgrading fails and I get an error message: “An error occured while trying to upgrade BracketHighlighter. Please restart ST to finish upgrade.”

Unfortunately restarting doesn’t do nothing to solve the problem. Any help is much appreciated. Thanks.

0 Likes

#119

Brilliant package! Very helpful.

I was wondering if there was a way to do the following:

  1. Make the Highlight Style syntax specific? E.g. I would like the style for a bracket to be “solid” when working on a LaTeX file, but “underline” (or default) otherwise.
  2. Get the highlight to essentially just change the colour of the bracket? Right now I am approximating this behaviour by enabling “solid” highlight style and setting the background colour of brackethighlighter.curly in my colour scheme file to match the background colour of the colour scheme.

Cheers!

0 Likes

#120

Thanks!

[quote=“cOrange”]

  1. Make the Highlight Style syntax specific? E.g. I would like the style for a bracket to be “solid” when working on a LaTeX file, but “underline” (or default) otherwise.[/quote]

Not currently. It would make the definitions a lot more complicated (more than they already are), but I won’t rule it out.

Doesn’t really work. This is a limitation of the Sublime API. I have tried setting the background to match the syntax background and tried changing font color to try and simulate the effect, but it just doesn’t work well with sublime. Sorry. If this ever changes in the sublime API moving forward, then I will gladly add the feature.

0 Likes

#121

Thanks for the reply. None of these are essential in any way, so no worries.

[quote=“facelessuser”]
Doesn’t really work. This is a limitation of the Sublime API. I have tried setting the background to match the syntax background and tried changing font color to try and simulate the effect, but it just doesn’t work well with sublime. Sorry. If this ever changes in the sublime API moving forward, then I will gladly add the feature.[/quote]

It’s alright; it works well enough as it is, I think: dl.dropboxusercontent.com/u/379 … acket.tiff .

Thanks!

0 Likes

#122

Hello!, previously in the past ST2 version, the bracket/character was highlighted when clicking to the right of it, like this: “)|”, now this will trigger to search the bracket to the right of it, instead of the clickedone … ahh! Is there any setting to return to the old behaviour? It was more user-friendly. :unamused:
Thanks for great package!

0 Likes

#123

[quote=“tito”]Hello!, previously in the past ST2 version, the bracket/character was highlighted when clicking to the right of it, like this: “)|”, now this will trigger to search the bracket to the right of it, instead of the clickedone … ahh! Is there any setting to return to the old behaviour? It was more user-friendly. :unamused:
Thanks for great package![/quote]

When I completely re-wrote the plugin to add in custom brackets, that feature didn’t get carried over, but it is on my list of things to look into bringing back. I had kind of grown to like it working only from within the brackets, but I understand that is a personal preference.

I’ve been pretty busy, but hopefully sometime soon, I can take a look at plugin issues and start working through them again.

0 Likes

#124

I am trying to add latex tables and figures as brackets but somehow it’s not working. Here is my attempt:

{ "name": "latex_floats", "open": "(\\begin\\{sidewaystable\\})", "close": "(\\end\\{sidewaystable\\})", "style": "default", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "LaTeX"], "enabled": true }

As a result, I only get the \end{sidewaystable} sourrounded with a black line and a ? indicating that ST is unable to find the opening bracket. Any idea why?

One more questions: If this works, I would like to extend it to something like “open”: “(\begin\{(table|sidewaystable|figure|sidewaysfigure|algorithm)\})”. But I don’t think that works because only one captureing group is allowed. That is the alternative? That’s a simple regex question, I guess.

0 Likes

#125

[quote=“gregor.hoch”]One more questions: If this works, I would like to extend it to something like “open”: “(\begin\{(table|sidewaystable|figure|sidewaysfigure|algorithm)\})”. But I don’t think that works because only one captureing group is allowed. That is the alternative? That’s a simple regex question, I guess.
[/quote]

You can use non-capturing groups: (?:something|something else|etc). You need one and only one capturing group, but you can have as many non-capturing groups as you need.

If you are still having trouble, please provide some example Latex Code I can test with. I don’t use every language, so I always ask people provide me with example code, a clear explanation of what the they want BH to highlight, and their best attempting at creating the rules and/or scripts needed. This helps save me time.

0 Likes

#126

You can use non-capturing groups: (?:something|something else|etc). You need one and only one capturing group, but you can have as many non-capturing groups as you need.

If you are still having trouble, please provide some example Latex Code I can test with. I don’t use every language, so I always ask people provide me with example code, a clear explanation of what the they want BH to highlight, and their best attempting at creating the rules and/or scripts needed. This helps save me time.[/quote]

Yes, of course. Here is some code

[code]\begin{sidewaystable}
\caption{this is a sidewaytable}

\end{sidewaystable}

\begin{table}
\caption{this is a table}

\end{table}

\begin{figure}
\caption{figure}

\end{figure}[/code]

And my is modified entry in the brackets array in bh_core.sublime-settings.

{ "name": "latex_floats", "open": "(\\begin\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})", "close": "(\\end\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})", // "open": "(\\begin\\{sidewaystable\\})", // "close": "(\\end\\{sidewaystable\\})", "style": "default", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "LaTeX"], "enabled": true }

I would like to highlight
\begin{sidewaystable}…\end{sidewaystable}
\begin{table}…\end{table}
\begin{figure}…\end{figure}

But I only get the \end{..} sourrounded with a black line and a ? indicating that ST is unable to find the opening bracket. Any idea why?

Thanks!

0 Likes

#127

The problem was simply you have to escape backslashes in regex but also escape backslashes in the JSON settings strings as well, which can cause slightly unintuitive escapeing:

So you want this:

\\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})

So you but this in your settings:

\\begin\\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\\})

but when the regex is read in from the JSON setting string, the regex looks like this:

\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})

So basically “\begin” wasn’t sufficiently escaped in the JSON setting string to translate to an appropriate escaped regex…I know, I know this is the convoluted stuff that happens when you represent a regex expression in a string.

This is what you need:
[pre=#252525] {
“name”: “latex_floats”,
“open”: “(\\begin\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})”,
“close”: “(\\end\{(?:table|sidewaystable|figure|sidewaysfigure|algorithm)\})”,
// “open”: “(\begin\{sidewaystable\})”,
// “close”: “(\end\{sidewaystable\})”,
“style”: “default”,
“scope_exclude”: “string”, “comment”],
“language_filter”: “whitelist”,
“language_list”: “LaTeX”],
“enabled”: true
},[/pre]

0 Likes

#128

(Failed to post the first time, trying again?)
Hello!
I’m sorry if it has been asked before, but I was playing with bracket highlighter (I’m still learning Sublime Text itself) and I was wondering if it was possible to only highlight the bracket itself, not the block as a whole…

Desired: (from Vim)

Actual: (from sublime)

0 Likes

#129

@Voaxeyr The readme explains all of this here: github.com/facelessuser/Bracket … ight-style

But to directly answer your question, you can copy the bh_core.sublime-settings file to your Packages/User folder and change the default to solid like shown below:

[pre=#252525] “default”: {
“icon”: “dot”,
“color”: “brackethighlighter.default”,
“style”: “solid”
},[/pre]

If you want to change a specific bracket to be this way, and others to be different, you can can tweak them on an individually; all of this is covered in the readme.

0 Likes

#130

Is there any website with style examples ? I see there’s a lot nice color schemes, no need to make it from scratch.

0 Likes

#131

@ceroz, I am not entirely sure what you mean; can you elaborate?

0 Likes

#132

I like your bh style:

I am looking for something similar but exactly the same characters on margin:
()
|
|
|
()

I would like to get some ready to use codes for styling my BH plugin :wink:

0 Likes