Sublime Forum

ST3: BracketHighlighter 2

#25

Maybe it’s just that user settings don’t work.

Tried this:

[code]{
“high_visibility_style”: “solid”,

}[/code]

Note that when choosing Preferences>Package Settings>Bracket Highlighter>Bracket Settings - User, the file that opens is: bh_core.sublime-settings. Is this the right file? Seems like it is in the right place if the menu command opens it. But, it appears that the setting is ignored.

0 Likes

#26

Everything has been well tested and is working. The problem is more than likely a misunderstanding of what I am doing vs what you want to do.

“highlight_visibility_style” will only be shown when high visibility mode is activated (if you don’t know what this is, you haven’t activated it). Documentation is pretty much non-existant right now, and I keep meaning to do it.

Here is a simple example of how styling works:

Here is a bracket definition defining matching for round brackets. Notice the style is set to round:
[pre=#2D2D2D] {
“name”: “round”,
“open”: “(\()”,
“close”: “(\))”,
“style”: “round”,
“scope_exclude_exceptions”: “string.other.math.block.environment.latex”],
“scope_exclude”: “string”, “comment”],
“language_filter”: “blacklist”,
“language_list”: “Plain text”],
“find_in_sub_search”: “true”,
“ignore_string_escape”: true,
“enabled”: true
},[/pre]

Here is the style definition called round defining the specifics. Notice when attributes are missing (or commented out in this example) the default will be used:
[pre=#2D2D2D] “round”: {
“icon”: “round_bracket”
// “color”: “brackethighlighter.round”,
// “style”: “underline”
},[/pre]

Go ahead and copy the entire bh_core.sublime-settings file to your user file and edit that directly.

0 Likes

#27

Thanks. I like the new features and speed.

How do I turn on high_visibility_mode? Did text search–somehow missed it.

I’ll make the user prefs file a copy of the whole thing and start there.

0 Likes

#28

Just type “high visibility” in the command palette and you should see it. It is a toggle command; you can turn it on and off at you like.

0 Likes

#29

Hush my mouth.

What would the easiest way be to get *matched * brackets to be more visible (realize a lot of people would hate this because most of our brackets are mostly matched…). Not quite as visible as high visibility mode makes unmatched brackets–basically just solid yellow and outlined?

For , {, (, ", and '…

0 Likes

#30

High Visibility mode was never meant for full time enabled, just when you really want to see the bracket extent very clearly.

I am not entirely sure what you are looking for from your description…is the solid setting not good for you? What exactly are you looking for?

0 Likes

#31

In st2, I highlight matching braces with a light yellow background. As I cursor around I can always see what’s in scope. In st2, the default outline approach conflicts with linter and the underlines weren’t very visible.

I suppose I could get used to it because now you use a very heavy underscore.

Reason for yellow background is for seeing matching brackets with many levels of nesting on a single line (the fold column bracket chars don’t help on a single line).

so, that’s what I want. It’s ok if not possible.

0 Likes

#32

You can use any style you like. The underscore is the default style but you can change the style of any bracket you want individually.

You can use the following: solid, underline, thin_underline, outline, squiggly, stippled, or none. solid will give you the background of the bracket colored.

Do something like this to make square brackets solid. Go under the “bracket_style” setting and find the bracket you want to change and set the style to solid:
[pre=#151515] “square”: {
“icon”: “square_bracket”,
“color”: “brackethighlighter.square”,
“style”: “solid”
},[/pre]

You can do anything in BracketHighlighter 2 that you could do in BracketHighlighter 1.

0 Likes

#33

Awesome. Thanks.

0 Likes

#34

fwiw, I haven’t been able to get this to work in ST3 either, despite multiple attempts.
Here’s what I get in the console:
ImportError: No module named ‘BracketHighlighter’
reloading plugin BracketHighlighter.BracketHighlighter
Traceback (most recent call last):
File “/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py”, line 72, in reload_plugin
m = importlib.import_module(modulename)
File “X/importlib/init.py”, line 88, in import_module
File “”, line 1577, in _gcd_import
File “”, line 1558, in _find_and_load
File “”, line 1505, in _find_and_load_unlocked
File “”, line 313, in _call_with_frames_removed
File “”, line 1577, in _gcd_import
File “”, line 1558, in _find_and_load
File “”, line 1522, in _find_and_load_unlocked
ImportError: No module named ‘BracketHighlighter’
reloading plugin BracketHighlighter.Elements
Traceback (most recent call last):
File “/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py”, line 72, in reload_plugin
m = importlib.import_module(modulename)
File “X/importlib/init.py”, line 88, in import_module
File “”, line 1577, in _gcd_import
File “”, line 1558, in _find_and_load
File “”, line 1505, in _find_and_load_unlocked
File “”, line 313, in _call_with_frames_removed
File “”, line 1577, in _gcd_import
File “”, line 1558, in _find_and_load
File “”, line 1522, in _find_and_load_unlocked
ImportError: No module named ‘BracketHighlighter’

0 Likes

#35

You are using BH not BH2. Remove that package. Assuming you are using package control, add the following as a repository (github.com/facelessuser/Bracket … ree/BH2ST3) and reinstall BracketHighlighter. If not, ensure you are using the BH2ST3 branch of BH.

0 Likes

#36

BH2 is now the master branch. BH1 is dead; long live BH2.

0 Likes

#37

I have BH2 installed with ST3 and I like the look of the bracket highlighting but I’m having issues with the matching accuracy on my php file. Specifically when I load the file with Notepad++ and go through all of the Divs they match perfectly but with BH2 most of them don’t match the correct opening or closing div markers. Any ideas?

0 Likes

#38

If you are talking about stray

tags under a PHP if else statement, then yes, BH is going to have a hard time with that. BH also has a hard time with similar things with compiler switches in C/C++ when people do wacky #if statements. This is a problem, because of 1. how BH tackles matching brackets and 2. the unpredictable places you can put the PHP if statements in the middle of HTML. If I added a whole lot more complexity, I could catch such things, but I don’t plan on doing that.

Of course, I have no idea if your problem is because of what I described above. Please post an example and explain the issue you are having so I can properly evaluate whether it is something I can and want to fix.

0 Likes

#39

[quote=“facelessuser”]If you are talking about stray

tags under a PHP if else statement, then yes, BH is going to have a hard time with that. BH also has a hard time with similar things with compiler switches in C/C++ when people do wacky #if statements. This is a problem, because of 1. how BH tackles matching brackets and 2. the unpredictable places you can put the PHP if statements in the middle of HTML. If I added a whole lot more complexity, I could catch such things, but I don’t plan on doing that.

Of course, I have no idea if your problem is because of what I described above. Please post an example and explain the issue you are having so I can properly evaluate whether it is something I can and want to fix.[/quote]


Fair enough. I don’t think that is the case here and I’m happy to post example. Not sure best way to do that so I’m pasting the whole page here (if you want something else let me know). THANKS!

<?php if (isset($_FILES'imgselect'])) { if (preg_match('/.](jpg)|(gif)|(png)$/', $_FILES'fupload']'name'])) { $filename = $_FILES'fupload']'name']; $source = $_FILES'fupload']'tmp_name']; $target = $path_to_image_directory . $filename; echo "You selected: " . $filename; // move_uploaded_file($source, $target); // createThumbnail($filename); } } ?>
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="myscript.js"></script>
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script>
$(function() {
    $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' }).val();
    });
</script>

Artist's Inventory

<?php include('topmenu.html'); ?>
    <div id="center">

    <!-- Add your site or application content here -->
Title:
Medium:
Subject:
Created:
Dimensions:
Sale Price:
Description:
<?php error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); require_once('dbconfig.php'); $query = "select idlocation, location_name from location"; // echo "
".$allquery; $result = mysqli_query($link, $query) or die('Unable to run query:' . mysql_error()); //$Pieces = mysqli_num_rows($result); // echo " (Number of Pieces: $Pieces)"; if (!$result) { echo "bad result"; echo mysql_errno($link) . ": " . mysql_error($link) . "\n"; } echo ""; while ($row = mysqli_fetch_assoc($result)) { echo "{$row'location_name']}"; } echo ""; ?>
        <label>Venue:</label>
        <input type="button" value="Add Venue" class="button_menu" onclick="addloc();"/> <br>
        <label>Notes:</label> <textarea class="inp" rows="8" cols="40" name="notes" id="notes"></textarea><br>


</div>  <!-- end div center -->
<div id="right">
    <h2>Image File:</h2>
<input type="file"  id="BrowserHidden"  name="image_file" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" />

<div id="BrowserVisible"><input type="text" id="FileField" /></div>
        <!-- <input type="submit" value="SUBMIT" />   -->
        <input type="button" value="Submit" class="button_menu sbtn"  onclick="vsubmit();"/>
    </form>  <br>
    



   </div>  <!-- end div right -->
        <div id="footer">
            Bruce Norman 2013
        </div>
</body>
0 Likes

#40

Edit: see my next post

0 Likes

#41

@brnorman hold up your html makes no sense.

You have a div open tag outside of a form block, but it closes inside the form block. No wonder I can’t resolve it. Your tags should be nested, but yours are in nonsensical order. Please review your code again first and see if it is still not working.

0 Likes

#42

[quote=“facelessuser”]@brnorman hold up your html makes no sense.

You have a div open tag outside of a form block, but it closes inside the form block. No wonder I can’t resolve it. Your tags should be nested, but yours are in nonsensical order. Please review your code again first and see if it is still not working.[/quote]

Sorry I missed that. The page worked as expected with my misplaced tags. Moved them and now BH2 works as expected too! I guess that’s a extra debug feature.

Thanks

0 Likes

#43

Yeah, browsers are forgiving to a fault. BH can catch some bad tags, but I wouldn’t stake my life on it catching them. So usually, if BH is matching things crazy, there is something in the file throwing it off. I can’t tell you how much time I spent hammering out that algorithm, so it is pretty reliable in well formed documents.

0 Likes

#44

I can believe it and I’m sure I don’t want to know how much time you spent but I and I’m sure many many others do appreciate it! :smiley:

0 Likes