Sublime Forum

BracketHighlighter

#24

Generally it is a good idea to restart after any plugin install, but I will make sure it is in the readme; it was at one point, but I might have removed it by accident.

Edit: Looks like the readme does already say you may need to restart ST2.

0 Likes

#25

Version 1.1

  • Add python raw string support for quote highlighting
  • Add highlighting of brackets in strings; will work in all strings, but mainly meant for regex. True by default
  • Add support for targetting regex strings like in javascript that are scoped as strings, but are not quoted, but use '/'s. True by default

Been really wishing I could highlight the brackets in regex strings. Now you can. Supports ],{},(); will ignore them if they are escaped. Bracket plugins currently do not target brackets inside of strings. Also added javascript style regex strings and python raw strings so you can target the brackets inside them as well.


0 Likes

#26

Version 1.4

  • Account for perl regex, substitutions, and translations surrounded by “/” for string bracket matching
  • Account for regex modifiers when matching regex surrounded by “/” in javascript and perl

Realized recently javascript regex bracket matching breaks if regex has modifiers at the end: /some_regex/gi
This should be fixed.

I also added support for perl and its match, substitution, and translation variants, and also its specific modifiers. Keep in mind this will only work if the regex is surronded by "/"s. The current syntax language for Perl doesn’t handle things like this to well: s#regex#substitution#, so I am not going to even try to support such things.

Let me know if you experience issues.

0 Likes

#27

awesome^

0 Likes

#28

So for little bit now tito has been bugging me about the way BracketHighlighter kicks off bracket matching :smile: . He isn’t the only one; there have been a number of people that expressed they wished it did more instant highlighting. There were issues with instant highlighting which is why by default I had set a bothersome delay.

I have been thinking about overhauling the match management code to allow for more responsive highlighting, but I have been lazy and been working on other things. Well, tito opened up dialog with me and we started talking about how we each thought it should be done. After a lengthy discussion and some swapping of code, we have kind of melded are methods into what I feel is a much more responsive highlighting.

I will currently be running it all day today with the experimental branch to ensure that it behaves like I expect it to. If you want to try it out, the experimental branch is here: github.com/facelessuser/Bracket … provements

Basically when highlighting will be instant in most cases (considering process time due to threshold distance). But subsequent events in close succession will be noted but not processed until things slow down a bit. We will have a background thread that will take care of this. The code also throws out redundant match requests as well to only match as many times as must be done.

I am hoping in general this will be a very responsive and good compromise between the two approaches. With this new method, you will no longer specify a delay in your settings, this will all be managed internally now. You can still set your search distance threshold. On fast computers, you may increase it, on really slow computers, you may decrease it. Obviously if you crank it up way too high, you will suffer from performance issues, but this has always and will always be the case.

Hopefully this will pacify the masses.

So as long as I see no real issues in performance (which I haven’t seen yet; at least on most modern machines), this will get pushed out tonight (as long as I don’t make other plans for tonight :wink: )

Anyways, if you try out the experimental, let me know how you like it (good or bad).

So if you like it, you can thank tito for the push to get this done. I probably would have sat around on this for a bit longer :smile:.

0 Likes

#29

Awesome. I changed the settings a bit to my liking so that it’s nearly instant. But how do I turn off the icon in the gutter? Seems like it should be simple but there is no option for “none.” And commenting it out seems to break the plugin?

0 Likes

#30

What do you mean? The experimental one should be pretty much instant now; you can’t even configure the delay anymore in the experimental one; all you can do is adjust search distance. Or are you using the main branch?

This will work. I will probably add an explicit “none” option in the future to be more clear.

"curly_icon" : "",
0 Likes

#31

“curly_icon” : “”, worked thanks!

Whoops, I was using the old version. Had to switch branches in Github for mac. :smile:

0 Likes

#32

Okay that makes sense. I was a little confused since the whole point of the experimental was to give near instant highlighting in most cases. I couldn’t understand what you would have changed. :smile:

0 Likes

#33

Oh, and you can use any icon you want as a bookmark, at least in recent builds, the catch is, the icon must be found in the default theme folder, not current theme you are using.

For instance I made a little white icon with transparent background (it must be white for the filter to color it proper). I called mine bracket.png for this experiment, and then referenced it like this.

"curly_icon" : "bracket",

And there you have it.


I noticed that the cross icon no longer worked, and then I noticed the cross icon is gone in the default theme. I tried dropping a test icon into my current theme, but it never would get picked up, so I tried the default and it worked. So really you can use anything as long as it exists in the default theme.

0 Likes

#34

Oh man. You can give it a relative path!

This is my setting.

//Icon? (dot/circle/bookmark/cross) "quote_icon" : "../BracketHighlighter/quote", "curly_icon" : "../BracketHighlighter/curly", "round_icon" : "../BracketHighlighter/round", "square_icon": "../BracketHighlighter/square", "angle_icon" : "../BracketHighlighter/angle", "tag_icon" : "../BracketHighlighter/angle",

This is what I get. (keep in mind I have the icons in these path for my test)


I feel a new feature coming…

0 Likes

#35

Awesome. Customize EVERYTHING!

The new version works so instantly it feels native.

Now I just need to spend several days fiddling with the colors. You probably shouldn’t have told me about the custom gutter icons. Now I need to make my own. TO PHOTOSHOP!

0 Likes

#36

If you come up with some good ones, and you would like to possibly have them included by default, let me know. I am going to work up a new version that will look in BracketHighlighter by default for all icons instead of the theme.

0 Likes

#37

https://github.com/facelessuser/BracketHighlighter/raw/master/example.png

Version 1.5

  • More responsive highlighting (thanks tito); delay setting no longer needed
  • Organize bracket plugins
  • Included more configurable custom gutter icons

If you hate the new icons, it is okay, you can change them back to dot or whatever. You can even create a folder with custom icons, and point BracketHighlighter at that folder in the settings file (the path must be relative to Package; you cans see what I did in the default settings file).

Edit:
You will probably want to restart after you upgrade; there might be glitches until you do :wink: .

0 Likes

#38

great update, thanks much.

0 Likes

#39

Looks good :smile:

I noticed there is the API

>>> sublime.active_window().active_view().line_height() 13.0

You may want to add different pngs depending on ranges of the size of the line. Because looks a little ugly when using a very tiny font size. :smiley:

0 Likes

#40

[quote=“tito”]Looks good :smile:

I noticed there is the API

>>> sublime.active_window().active_view().line_height() 13.0

You may want to add different pngs depending on ranges of the size of the line. Because looks a little ugly when using a very tiny font size. :smiley:[/quote]

Good call; hadn’t checked that scenario. I based it off the sizes already used by ST2. I will look into adding small versions, and create some convention of naming so the plugin will always no how to find the small variant. Either that, or I will revert to some tiny default.

0 Likes

#41

This should work for the tiny text people :smile: .


Should have it out soon.

0 Likes

#42

Version 1.5.2

  • Use tiny icons when line height is less than 16
  • Use no icon if icon cannot be found
  • Optimize png icons

That took longer than I would have liked.

0 Likes

#43

how do you get your highlights/icons coloured in different colors?

0 Likes