Sublime Forum

BracketHighlighter

#91

I figured that might be the case. If I get the time I might fork and give it a go to see how it handles performance-wise. I think it is be a matter of personal opinion whether such an addition makes things cluttered or more usable :smile:.

0 Likes

#92

Yeah, I understand. Another problem is, it won’t be a simple addition. Everything is streamlined to do it the current way. Anyways, good luck.

0 Likes

#93

Version 1.8.0

  • Add new commands: “Show Bracket String Escape Mode” and “Toggle Bracket String Escape Mode”. Default is “regex”

Small update to allow you to toggle the string escape mode for string brackets. There are two modes “regex” and “string”:

string escape: \{
regex escape: {

I was kind of annoyed today when I was trying to modify some regex in a string in a JSON file, and BracketHighlighter was getting matches wrong. The current method works great when you are in something like Javascript/Perl regex etc., but not a normal string that is to be converted into regex. So now you can simply toggle to a different escape mode if you need to.

0 Likes

#94

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.

0 Likes

#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