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: 846
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: 1541
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: 846
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: 1541
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: 1541
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

Previous

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 10 guests