i was thinking the same.
match the first bracket you find in either direction, thatâs why itâs called BracketHighlighter
BracketHighlighter
[quote=âvitaLeeâ]i was thinking the same.
match the first bracket you find in either direction, thatâs why itâs called BracketHighlighter [/quote]
Its just fitting it into the algorithm is a little tricky. It was streamlined to do it one way, but to do it the way you are suggesting may take me a while to do well (if I get it working good at all). Also, it is not on the top of my list of things to do since it would also be big headache to make happen.
What I plan to do in the next week is to resolve my current issue with strings:
- I donât like that I am wasting time detecting regex conventions for different languages in strings, and I think it is silly I am highlighting â/â in regex strings. So I am thinking I want to only highlight quoted strings, but still allow the searching for and highlighting of internal string brackets in any non-quoted strings. If no brakcets are found in a non-quoted string, I want to ignore the string and find the next parent bracket. It would be a more generic support for brackets inside any string, and it would support more languages.
- This could also apply to people who donât want to highlight quotes, but still like to highlight brackets inside strings.
Version 1.7
- Hide parent quote highlighting when child quotes are highlighted
- Allow the searching for brackets in non-quoted code scoped as strings (like regex)
- Add setting âhighlight_string_brackets_onlyâ which allows never highlighting quotes but leaves internal string bracket highlighting on
- deprecate âenable_forward_slash_regex_stringsâ in favor of âfind_brackets_in any_stringsâ
Hopefully that all makes sense, basically I just made some tweaks to string highlighting and allow for string bracket highlighting now to occur in any string scope.
Forgive me if this has been mentioned, but Iâd find it epically cool and useful to have multiple bracket types highlighted at once (with only one insertion point) like this:
[quote=âpeppyâ]Forgive me if this has been mentioned, but Iâd find it epically cool and useful to have multiple bracket types highlighted at once (with only one insertion point) like this:
The problem is, BracketHighlighter is designed to minimize how much time it is searching to give you pretty instant highlighting without bogging down your editor. By doing what you suggest, you would have to keep crawling back looking for even more brackets; this would take more time on every search.
Also, I think it would make things more cluttered. The point of BracketHighlighter is to quickly show you what block you are in, but if all the blocks get highlighted, it is not nearly as effective at quickly showing you were you are.
Though opinion may differ on this point, I do not foresee this becoming an addition to BracketHighlighter, but thanks for your interest.
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 .
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.
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.
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â:
- âdefâ would match the final âendâ.
- â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=â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â:
- âdefâ would match the final âendâ.
- â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.
[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
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>
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",
}
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";
[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.
thanks about your quick response.
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=âvitaLeeâ]thanks about your quick response.
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 .
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=â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]
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.