Home Download Buy Blog Forum Support

BracketHighlighter

Re: BracketHighlighter

Postby tito on Thu Jun 05, 2014 3:49 am

Thanks for the information, I'm a little lost on how to configure it to get that behaviour. :oops:, have been trying and watching the settings with no suscess, I also have some fear to break the current behaviour, my settings are just:
Code: Select all
{
   // Character threshold to search
   "search_threshold": 50000,
   "bracket_outside_adjacent": true,
   "no_multi_select_icons": true,
   "bracket_styles": {
      "tag": {
         "icon": "tag",
         // "color": "brackethighlighter.tag",
         "style": "underline"
      }
   }
}


Oh, another request I just reminded, more important than the previous request; When a tag is outlined, it currently outlines the complete tag. For XML/RDF/XUL files this is somewhat distracting, for example currently the following between brackets is outlined:
Code: Select all
[<dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI">]http://url.tld/N[</dcterms:identifier>]
It would be nice to just highlitgh the tag name, as
Code: Select all
<[dcterms:identifier] rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI">http://url.tld/N</[dcterms:identifier]>

I known( really ??) this may be complicated for the self-closing case ?
Code: Select all
<[dcterms:identifier] rdf:resource="http://url.tld"[/]>

There are also these infinite opening tags.. and that /really/ disturbs
Code: Select all
<input
  onsomething1="yaydaydya1()"
  onsomething2="yaydaydya2()"
  onsomething2="yaydaydya3()"
  onsomething3="yaydaydya4()"
  onsomething4="yaydaydya5()"
  onsomething4="yaydaydya6()"
  onsomething5="yaydaydya7()"
  onsomething6="yaydaydya8()"
  onsomething7="yaydaydya9()"
/>


Could be easily tweaked? I guess you are aware of this
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: BracketHighlighter

Postby facelessuser on Thu Jun 05, 2014 4:19 am

tito wrote:Thanks for the information, I'm a little lost on how to configure it to get that behaviour. , have been trying and watching the settings with no suscess, I also have some fear to break the current behaviour, my settings are just:
CODE: SELECT ALL
{
   // Character threshold to search
   "search_threshold": 50000,
   "bracket_outside_adjacent": true,
   "no_multi_select_icons": true,
   "bracket_styles": {
      "tag": {
         "icon": "tag",
         // "color": "brackethighlighter.tag",
         "style": "underline"
      }
   }
}

Lol, yeah, I understand that. It is one of those things that I wanted to be super simple, but it is *so* configurable that setting it up can be complicated. If I get some time in the next week, I may PM you with the basic idea.

tito wrote:Could be easily tweaked? I guess you are aware of this

In BH1 I used to have a low profile tag highlight mode

Code: Select all
[<]input ... /[>]


Code: Select all
[<]dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"[>]http://url.tld/N[<]/dcterms:identifier[>]


I can probably add that back in again pretty easily. Create an issue, and I will look into exposing a tag plugin setting to do this.
facelessuser
 
Posts: 1573
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby tito on Fri Jun 06, 2014 12:36 am

Issue added thanks for consideration
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: BracketHighlighter

Postby facelessuser on Fri Jun 06, 2014 5:39 am

Thanks, it may be a bit before I get to it. Not sure yet how much would need to be changed to make this happened (hopefully not too much, but I never know till I get into it). It was straight forward in BH1, but BH1 was less complicated times.
facelessuser
 
Posts: 1573
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby facelessuser on Sun Jun 22, 2014 9:58 pm

New Feature to help with defining custom rules added (ST3 ONLY).

One of the slightly annoying things about BH is that if you want to try out a custom rule, or modify an existing one, you need to copy the whole default set of rules. If you do this in your User folder, new updates to BH rules will not be picked up until you rebase your rules.

Well, I set out to fix that with some new changes I will outline below:

Let's say you have a custom language you want to have on your machine. Now, you can simply add it to one of the two settings arrays: "user_scope_brackets" and "user_brackets":

    "user_scope_brackets": [],
"user_brackets": [
{
"name": "mylang",
"open": "^\\s*\\b(if|subr|bytemap|enum|command|for|while|macro|do)\\b",
"close": "\\b(e(?:if|subr|bytemap|enum|command|for|while|macro)|until)\\b",
"style": "default",
"scope_exclude": ["string", "comment"],
"plugin_library": "User.bh_modules.mylangkeywords",
"language_filter": "whitelist",
"language_list": ["mylang"],
"enabled": true
}
],



Let's say you want to modify an existing rule, maybe just tweak the language list, all you have to do is use the same name and the item you want to change. Only that attribute will be overridden:
    "user_brackets": [
// Angle
{
"name": "angle",
"language_list": [
"HTML", "HTML 5", "XML", "PHP", "HTML (Rails)",
"HTML (Jinja Templates)", "HTML (Twig)", "HTML+CFML",
"ColdFusion", "ColdFusionCFC", "laravel-blade",
"Handlebars", "AngularJS",
"SomeNewLanguage" // <--- New language
]
}
],




Let's say I want to insert a new rule between two rules. I can turn on debug mode and call the BracketHighlighter: (Debug) Filter Rules by Key then select position to see the current rule order and their postion index:

[
[
{"name": "curly", "position": 0},
{"name": "round", "position": 1},
{"name": "square", "position": 2},
{"name": "html", "position": 3},
{"name": "cfml", "position": 4},
{"name": "php_angle", "position": 5},
{"name": "angle", "position": 6},
{"name": "cssedit_groups", "position": 7},
{"name": "ruby_embedded_html", "position": 8},
{"name": "ruby", "position": 9},
{"name": "c_compile_switch", "position": 10},
{"name": "php_keywords", "position": 11},
{"name": "erlang", "position": 12},
{"name": "bash", "position": 13},
{"name": "fish", "position": 14},
{"name": "mylang", "position": 15}
],
[
{"name": "py_single_quote", "position": 0},
{"name": "py_double_quote", "position": 1},
{"name": "single_quote", "position": 2},
{"name": "double_quote", "position": 3},
{"name": "jsregex", "position": 4},
{"name": "perlregex", "position": 5},
{"name": "rubyregex", "position": 6},
{"name": "mditalic", "position": 7},
{"name": "mdbold", "position": 8}
]
]



Then you can specify the position you want to insert at:

    "user_scope_brackets": [],
"user_brackets": [
{
"name": "mylang",
"position": 4, // <-- New position
"open": "^\\s*\\b(if|subr|bytemap|enum|command|for|while|macro|do)\\b",
"close": "\\b(e(?:if|subr|bytemap|enum|command|for|while|macro)|until)\\b",
"style": "default",
"scope_exclude": ["string", "comment"],
"plugin_library": "User.bh_modules.mylangkeywords",
"language_filter": "whitelist",
"language_list": ["mylang"],
"enabled": true
}
],



And if you run the debug command again, you will see that the position has changed:

        {"name": "curly", "position": 0},
{"name": "round", "position": 1},
{"name": "square", "position": 2},
{"name": "html", "position": 3},
{"name": "trex", "position": 4}, // <-- New position
{"name": "cfml", "position": 5},
{"name": "php_angle", "position": 6},




This can be used to adjust the position of default rules from your user settings as well as shown by overrides above.

So, unless you are forking BH to pull request a change to the default rules, you can now modify the rules all in these two settings without copying or touching the default rules:

    "user_scope_brackets": [],
"user_brackets": [],



This will allow you to make changes, but still receive new updated rules.

**Debug mode is a setting in the settings file. Toggling debug mode via command palette only changes the settings in memory, so when you save the settings file, it reverts back to the original. I choose not to save it automatically to the settings file so as not to regenerate the settings file and erase all the comments in the settings file. If you want to put the plugin in a more "hard" debug mode, set "debug" to "true" manually in your settings file.
facelessuser
 
Posts: 1573
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby ErdeFB on Wed Jul 09, 2014 10:23 am

Hello!

Sorry if this is the wrong place to ask for this.

I love this plugin, but I lack, err, the artistic eye (reason I don't do website design) so am having a hard time making visually appealing colour choices
and highlighting styles for myself. If anyone could share their relevant settings for a dark backgrounds I'd appreciate it. :)

Sorry for the inconvenience. :oops:
ErdeFB
 
Posts: 4
Joined: Wed Jul 09, 2014 10:18 am
Location: Finland

Re: BracketHighlighter

Postby facelessuser on Sun Aug 17, 2014 11:21 pm

A couple of new additions (ST3 Only):

Content Bar
This is an experimental content bar. This is a feature that has been requested a number of times, but I have held off due to Sublime's limitations. I have added recently only as an experiment, but I may keep it around. This is experimental and not guaranteed to stick around and its features/behavior are subject to change. The future of this feature depends on the feedback I get, so please do give feedback: negative or positive.

So This experimental feature exists in two forms. The first can be seen by enabling the new "content_highlight_bar" setting. This will draw a line highlighting a brackets content at the start of the line. This has the lowest overhead and works with monospace fonts and proportional fonts.

Image

So the second form has a bit more overhead and probably only works well on monospace fonts. This form draws the content bar at the brackets indentation level. It can not draw the line across empty spaces, and I currently do not draw the line if text comes before the line (this is illustrated in the first example below). Feature requires "content_highight_bar" and "align_content_highlight_bar" to be set to true.

Image

Toggle Brackets
This feature is made possible by some changes made to the "bracketselect" bh_plugin. By setting up the selection key binding as shown below, instead of jumping through nested brackets in just one direction, this binding will toggle between the opening and closing of the current bracket only:

    {
"keys": ["ctrl+m"],
"command": "bh_key",
"args":
{
"no_outside_adj": true,
"lines" : true,
"plugin":
{
"type": ["__all__"],
"command": "bh_modules.bracketselect",
"args": {"select": "right", "alternate": true}
}
}
},


Anyways hope you enjoy, and please leave feedback about the experimental content bar feature.
facelessuser
 
Posts: 1573
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby nadiam02 on Thu Aug 21, 2014 10:53 am

Hi, Im just wondering if the brackets(open n close) is not highlighted does that mean that there is something wrong with the codes in the brackets? because i have something like this:
Code: Select all
if()
{
  if()
  {
     
  }
  else
  {

  }
}


the second ifs curly brackets and else are highlighted but the first ifs curly bracket doesnt get highlighted.
nadiam02
 
Posts: 1
Joined: Thu Aug 21, 2014 10:36 am

Re: BracketHighlighter

Postby facelessuser on Thu Aug 21, 2014 4:50 pm

nadiam02 wrote:the second ifs curly brackets and else are highlighted but the first ifs curly bracket doesnt get highlighted.


You need to be a bit more specific on your scenario. Where are your cursors? BH highlights the immediate brackets enclosing the cursor. It does not show all nested brackets, just eh immediate brackets around the cursor.
facelessuser
 
Posts: 1573
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby kmm2908 on Mon Sep 22, 2014 2:00 pm

Great package, has been a real time saver for me.

I have a question though. I cannot get curly bracket icon to show in same color as bracket highlight; it just shows in black which is really hard to see. You have to look really closely to see at all.

Tried everything; can you suggest how I can change this please?

Screenshot:

Image

When setting the color options what are the difference between the foreground and background please?
kmm2908
 
Posts: 1
Joined: Mon Sep 22, 2014 1:53 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests