Sublime Forum

BracketHighlighter

#185

@kmm2908, only set the foreground color.

Sublime takes the foreground color and tints the icon. Background color should do nothing.

0 Likes

#186

[quote=“facelessuser”]@kmm2908, only set the foreground color.

Sublime takes the foreground color and tints the icon. Background color should do nothing.[/quote]

Yep that fixed it thanks!

0 Likes

#187

Hi everybody,

I am trying to modify the highlight of html tags. I would like the common tag be highlighted like that

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras congue quis augue eget blandit.

instead of

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras congue quis augue eget blandit.

I tried to change the “open” and “close” attributes of “angle” style (with copying pasting code below in “user_brackets” behavior), or change “scope_exclude” parameters, no to avail !

"user_brackets": { "name": "angle", "open": "(<)(?=^?%]|$)", "close": "(?:(?<=^?%])|(?<=^))(>)", "style": "angle", "scope_exclude": "string", "comment", "keyword.operator", "source.ruby.rails.embedded.html", "source.ruby.embedded.html"], "language_filter": "whitelist", "language_list": "HTML", "HTML 5", "XML", "PHP", "HTML (Rails)", "HTML (Jinja Templates)", "HTML (Twig)", "HTML+CFML", "ColdFusion", "ColdFusionCFC", "laravel-blade", "Handlebars", "AngularJS"], "plugin_library": "bh_modules.tags", "enabled": true } ],

Someone could help me please ?

Thanks in advance

0 Likes

#188

You can try setting endopoints to your tag style under bracket_styles:

[pre=#232628] “tag”: {
“icon”: “tag”,
“color”: “brackethighlighter.tag”,
“style”: “outline”,
“endpoints”: true
},[/pre]

This will only highlight the angled brackets of an opening and closing tag. This is a little more low profile, but currently, an option to highlight just the tag name does not exist. I don’t hard code highlights for specific rules as the core code is generic. Maybe in the future I will add a hook to allow a bh_plugin to modify the highlight region separately from the tag region.

0 Likes

#189

I am trying to reproduce the notepad++ behaviour for a upcoming theme, so your trick doesn’t help me unfortunately.
Thank you for the speed and clarity of your reply !

0 Likes

#190

I realize it’s not the same; so, if it’s “that” or nothing, then yes, you are out of luck unless I get motivated sometime soon to add such a feature.

0 Likes

#191

FYI, a critical bug that was introduced with the latest Sublime build 3067, has been patched in the latest BH. Please update to avoid having Sublime freeze up.

Also, I added a new hook that now allows for tag brackets to only highlight the tag name. There has been a number of requests for this in the past.

0 Likes

#192

So it was something wrong! Dev Build 3067

0 Likes

#193

I don’t know if the crashes were related, but Jon changed how EOF was handled in match_selectors which caused BH to go into an infinite loop when processing scope rules at the end of a file.

0 Likes

#194

FYI for BH users. A new public beta for Sublime should be coming out soon. Some recent changes had been made to Sublime on the dev releases that were incompatible with BH causing freezing or crashing. BH has since been patched, but Jon wanted to minimize bug reports when the new beta is released, so he contacted me and we worked out a way for him to exclude older BH versions that don’t have the fix.

Basically, in the 2.4.0 release I did this morning, I added a dummy file that can be checked by Sublime. When the new beta drops, all BH releases before the 2.4.0 release will not work on 3070+ builds of Sublime. My advice is to upgrade now.

Edit: Go with 2.4.1 instead. I was dumb and broke HTML tags in PHP syntax; 2.4.1 fixes that. Oh well.

0 Likes

#195

Hello! Please help me!)) Whats wrong here?
http://savepic.net/6577435m.jpg
If I open this code in NP++, I have normal highlighted bracket.

Here my code:

<div> <vb:if condition="$issue'newflag']"><a href="issue.php?{vb:raw session.sessionurl}do=gotonote&amp;issueid={vb:raw issue.issueid}&amp;goto=firstnew"><img src="{vb:stylevar imgdir_button}/firstnew.png" alt="{vb:rawphrase go_to_first_new_post}" border="0" /></a></vb:if> <a href="{vb:link issue, {vb:raw issue}}" title="{vb:raw issue.summary}" <vb:if condition="$issue'newflag']"> class="boldtext"</vb:if> id="issue_title_{vb:raw issue.issueid}">{vb:raw issue.title}</a> <vb:if condition="$issue'pagenav']"> <dl class="pagination" id="pagination_issuebit_{vb:raw issue.issueid}"> <dd> <vb:each from="issue.pagenav" value="issuepagenav"> <span><a href="{vb:link issue, {vb:raw issue}, {vb:raw issuepagenav.pageinfo}}">{vb:raw issuepagenav.curpage}</a></span> </vb:each> <vb:if condition="$show'pagenavmore']"> <span class="separator">...</span> <span><a href="{vb:raw issue.lastpagelink}">{vb:raw issue.totalpages}</a></span></vb:if> </dd> </dl> </vb:if> </div>

Thanks!

0 Likes

#196

Because you are using some non-pure HTML language. Maybe some template language I am unfamiliar with. But whatever you are using, you have tags inside of tags which breaks the tag identification.

0 Likes

#197

Yeah… But as I say above… With NP++ I do not have this problem. Perhaps you should optimize the definition of the start/end of tags and make it more a versatile, instead focus on the “non-pure HTML language” ? ))
http://savepic.net/6605086m.jpg

I love Sublime Text(and your plugin is cool too), and really want to see them even more handy! Thanks!

0 Likes

#198

So … What can I take here? As I understand, the problem appears with the tags:

<vb:if condition> <vb:each from>
(maybe somethings else?)
Is it possible to add in the plugin some custom settings, to make possible processing this tags, so that the standard tags to continue to work without this problems?
Thanks again!

0 Likes

#199

The problem isn’t the new tags, but that you are using them in the middle of the HTML opening tag.

0 Likes

#200

In general, it is not me use them so, but developers of vBulletin. So… I think that many users ST encounter this problem.
Please tell me how, in this case, to solve this problem? It is possibly?

0 Likes

#201

With the current way BH is implemented, it will be very difficult to handle these cases. BH uses regex to find the html tags. Now you (or someone else) are inserting more tags inside the tags attribute area. It should be very clear why this breaks detection. At one point, I tried to use scope extent to effectively get the range of a tag, but that proved fruitless due to the way HTML is scoped. The problem you are experiencing is not an uncommon one. When people do similar things in other languages (like PHP) you can get the same effect.

Since BH is a very generalized bracket matching engine, it doesn’t have the needed complexity to handle these kinds of language specific issues at this time. Certain scenarios will stress it beyond the point where it can effectively highlight; I won’t go into all of them here though. Maybe in the future if the engine was redesigned to provide more hooks or to approach finding the brackets differently, these kinds of problems could be worked around, but I imagine there would need to be significant changes to how BH approaches finding brackets to have any hope of handling these types of problems. Also, keep in mind, BH is an unfunded plugin despite its massive user base; I can count on one hand the number of people who ever have donated to it, so I am not itching to overhaul the entire framework as it is my free time that goes into development.

Also, I don’t use vBulletin, so I have no interest in spending time on improving vBulletin support. Now that might sound harsh, but remember it is my free time that goes into improvements of not just this plugin, but many others as well. I don’t have time to learn the ins and outs of every language that people use. I provide a core, and I provide personal support for languages I have a vested interest in, but support for other languages, I leave up to the community to figure out. I do take input on how the core could be improved to accommodate other languages, and I also accept pull requests.

1 Like

#202

I would say one more thing. I don’t know how vBulletin is used, so it is possible that you could adjust the regex for tags and it get it working as traditional cases of nesting vb tags inside other tags may not be that bad (again, I don’t use vb tags, so I don’t know). If the regex is solid enough I would accept a pull request. I am not going to spend time on it personally though as I don’t use vBulletin.

0 Likes

#203

Thanks!
Please “direct me” where I need to change regex?
As I understand, I must create new regex in: bh_core.sublime-settings - user with follow structure:

"brackets": // NewHTML { "name": "html", "open": "(<)(?=\\w\\:\\-]+(?:(?:\\s+\\w\\-:]+(?:\\s*=\\s*(?:\"^\"]*\"|'^']*'|^>\\s]+))?)*)\\s*\\/?>|\\/\\w\\:\\-]+^>]*>)", "close": "(?<=<)(?:\\w\\:\\-]+(?:(?:\\s+\\w\\-:]+(?:\\s*=\\s*(?:\"^\"]*\"|'^']*'|^>\\s]+))?)*)\\s*\\/?|\\/\\w\\:\\-]+^>]*)(>)", "style": "tag", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "HTML", "HTML 5", "XML", "PHP", "Handlebars"], "plugin_library": "bh_modules.tags", "find_in_sub_search": "only", "enabled": false }, ]
and try to change strings:
“open”: ***********
“close”: ***********

??

0 Likes

#204

[quote=“taravasya”]Thanks!
Please “direct me” where I need to change regex?
As I understand, I must create new regex in: bh_core.sublime-settings - user with follow structure:

"brackets": // NewHTML { "name": "html", "open": "(<)(?=\\w\\:\\-]+(?:(?:\\s+\\w\\-:]+(?:\\s*=\\s*(?:\"^\"]*\"|'^']*'|^>\\s]+))?)*)\\s*\\/?>|\\/\\w\\:\\-]+^>]*>)", "close": "(?<=<)(?:\\w\\:\\-]+(?:(?:\\s+\\w\\-:]+(?:\\s*=\\s*(?:\"^\"]*\"|'^']*'|^>\\s]+))?)*)\\s*\\/?|\\/\\w\\:\\-]+^>]*)(>)", "style": "tag", "scope_exclude": "string", "comment"], "language_filter": "whitelist", "language_list": "HTML", "HTML 5", "XML", "PHP", "Handlebars"], "plugin_library": "bh_modules.tags", "find_in_sub_search": "only", "enabled": false }, ]
and try to change strings:
“open”: ***********
“close”: ***********

??[/quote]

No, I that rule is disabled and was more an experiment that I should probably remove. Tags are actually triggered off the angle bracket rule and then fed through a bh_plugin called tags: github.com/facelessuser/Bracket … ags.py#L10. The regex for determining HTML tags is found there.

0 Likes