Sublime Forum

BracketHighlighter

#95

[quote=“Acciaccatura”]Thanks for this great plugin, it’s very useful.

I was wondering if you had any plans to add support for Ruby, particularly the matching of Ruby’s method and block syntax? I noticed you mentioned you weren’t a Ruby developer, so here’s a quick example:

def my_function(things)
  things.each do |thing|
    ...
  end
end

In this example, there would be two pairs of “braces”:

  1. “def” would match the final “end”.
  2. “do” would match the other “end”.

I had a quick look at implementing this myself in the hope it was a quick change, but didn’t get too far with my limited Python experience.[/quote]

The functionality you are looking for is the same as highlighting brackets, but the code to highlight these keywords like brackets don’t fit in the algorithm at all.

You are not the first to ask this, and I have not yet decided if I want to pursue this yet. I will consider it, but I will not make any promises.

0 Likes

#96

[quote=“facelessuser”]
The functionality you are looking for is the same as highlighting brackets, but the code to highlight these keywords like brackets don’t fit in the algorithm at all.

You are not the first to ask this, and I have not yet decided if I want to pursue this yet. I will consider it, but I will not make any promises.[/quote]

Thanks for replying; I figured I wouldn’t be the only one interested in this feature. Fingers crossed this gets onto the roadmap :smile:

0 Likes

#97

I have a (hopefully) quick question about the margin bracket symbols. I like them a lot and they look very good in Soda Theme (light grey without coloring). However, for markdown files I use MarkdownEditing and the margin brackets are colored in an ugly green. I tried to fix it by adding the code below (and more) to the .tmTheme file but it doesn’t change anything. Any ideas?

Also about markdown: ` brackets are not supported, right?

Thanks for the great plugin!

github.com/ttscoff/MarkdownEditing

<dict> <key>name</key> <string>Bracket Tag</string> <key>scope</key> <string>bracket.tag</string> <key>settings</key> <dict> <key>foreground</key> <string>#FD971F</string> </dict> </dict>

0 Likes

#98

Then you have to tell BracketHighlighter to use that scope in the user preferences. Go to Preferences > Package Settings > Bracket Highlighter > Settings - User and add the following:

{ "quote_scope" : "bracket.quote", "curly_scope" : "bracket.curly", "round_scope" : "bracket.round", "square_scope": "bracket.square", "angle_scope" : "bracket.angle", "tag_scope" : "bracket.tag", }

0 Likes

#99

i noticed several things when i tried swap quotes plugin
quoted text at column 1 doesnt trigger bracket highlights.
that’s not what initially caught my attention but i think it may be related to the next thing.
having delcaration like this

a = 'bc'

when i try “swap quotes” i get

a = "b"'

notice that in its initial state the line ends with the closing quote.
if you add whatever character at the end of the line, then it works as expected

a = 'bc';
a = "bc";
0 Likes

#100

[quote=“vitaLee”]i noticed several things when i tried swap quotes plugin
quoted text at column 1 doesnt trigger bracket highlights.
[/quote]

Can you elaborate because I do not understand what problem you are describing.

[quote=“vitaLee”]
that’s not what initially caught my attention but i think it may be related to the next thing.
having delcaration like this

a = 'bc'

when i try “swap quotes” i get

a = "b"'

notice that in its initial state the line ends with the closing quote.
if you add whatever character at the end of the line, then it works as expected

a = 'bc'; a = "bc"; [/quote]

I know what this is. I will have it fixed sometime soon.

0 Likes

#101

Swap quotes should now be fixed.

0 Likes

#102

thanks about your quick response. :smile:
about my first note try this:
open new blank document.
change syntax to some not ignored by the plugins and type quoted text.
then move the caret between quotes.
the brackets icons will not show in the gutter. you won’t be able to swap quotes too.
it’s super unimportant and few would notice it, but i decided to bring it up since it’s obviously an edge case and might reflect somewhere else.

0 Likes

#103

[quote=“vitaLee”]thanks about your quick response. :smile:
about my first note try this:
open new blank document.
change syntax to some not ignored by the plugins and type quoted text.
then move the caret between quotes.
the brackets icons will not show in the gutter. you won’t be able to swap quotes too.
it’s super unimportant and few would notice it, but i decided to bring it up since it’s obviously an edge case and might reflect somewhere else.[/quote]

Fixed. An algorithmic oversight on my part. Thanks for letting me know. I wouldn’t have caught that for a while :smile:.

0 Likes

#104

Thanks for the addon facelessuser,
How can I make it change the color of the brackets only without highlighting?
I also noticed sometimes it takes a second to take action.

0 Likes

#105

[quote=“Maxand”]Thanks for the addon facelessuser,
How can I make it change the color of the brackets only without highlighting?
I also noticed sometimes it takes a second to take action.[/quote]

:confused: I am not sure what you mean.

If you are asking that you would like the bracket font to change color without putting a block or outline or underline around it, then that is impossible with the current ST2 API. If/when that functionality is available, I would have no problem adding that.

If you are looking for a more minimal highlight, I suggest using style “underline” and for the icon put “none”. That will only underline your brackets with a colored underline. That is as minimal as BracketHighlighter can do.

0 Likes

#106

Thanks for the reply facelessuser,

Yes you understood me just right, things is, I just switched from Notepad++ and used to have brackets changing color when caret next to them, no highlight box.
I guess I will have to wait for future implementation.
Again, thanks a lot for this great addon http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif

0 Likes

#107

New version of BH pushed out.

-Better detection of auto-closing tags (hopefully)
-Experimental CFML support (read the readme for more info)

Also, I want to prepare people because very soon I will be removing possibly all of BH’s shortcuts by default. Currently, most of the shortcuts use ctrl+shift+b (or super+shift+b on mac) which apparently overrides one of ST2’s built in shortcuts (something to do with build systems…can’t remember off the top of my head). Anyways, moving forward very soon I will remove the shortcuts and provide an example file instead. This way the user can set up shortcuts they like (you can even keep them the same as they are now if you don’t mind the shortcut override; you just will need to define them yourself). This will prevent issues being filed in the future about shortcuts overriding other shortcuts.

Again, all the functionality will remain the same, but the user will have to define their own shortcuts, but I will provide an example file that can be used as a template. So now would be a good time to copy the BH shortcuts to your Default (whatever OS).sublime-keymap file to prepare for the future.

On a side note, if you use the HexViewer plugin, the same will happen for that plugin’s shortcuts as well since it use the same shortcut in its sequences.

0 Likes

#108

I’ve loved this plugin for a long time in my workflow… It is so good! Thanks facelessuser for all your time thus far.

However, suddenly it no longer seems to be working? The take home feature for me, to be able to easily select everything between quotes or parens or whatever is no longer functional. I tried changing the shortcut and updating the shortcut in the sublime keymap but to no avail… When triggering using the hotkey, simply nothing happens.

Anybody else experiencing this?

0 Likes

#109

This has never stopped working for me. I will verify again tonight on the BH1 branch (I am running BH2 right now :wink: ), but if it isn’t working for you, there might be a shortcut conflict.

I also have this working for BH2 right now as well (though the shortcuts do not come defined out of the box).

0 Likes

#110

Thanks for your work, faceless!

Please excuse my ignorance if I missed it but has BH2 been released already? I couldn’t find it on your github page.

0 Likes

#111

Released officially know, but you can try it out. On the BracketHighlighter Github page, there is a branches drop down list where you can select the BH2 branch. The direct link is here: github.com/facelessuser/Bracket … r/tree/BH2.

I am working on documentation. It is pretty much done. As soon as I can write up all the documentation, I will release it. All planned features etc. are currently in.

0 Likes

#112

sorry if I missed something but is the update going to be automatic from BH1 to BH2 through package control?

0 Likes

#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