Sublime Forum

ST3: BracketHighlighter 2

#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

#45

HI there,
Hey bracket highlighter is really great! Thanks for putting in the work there. Just wondering though I can’t seem to get my highlights to be anything but white…

How could I mess around with that color to make it a little less harsh?
Thanks
Pete

0 Likes

#46

@pete Glad you like it.

Take a look at the readme, I talk about how you can change the colors. Also search the issues on github, I explain it multiple times there as well. If you are still having trouble after that, let me know.

0 Likes

#47

Cool thanks mate!

0 Likes

#48

New version 2.18.0 out with new experimental hover popup to show off screen bracket pair when mousing over visible bracket pair. This is experimental and depending on how it is received will determine if it sticks around.

Edit: you must be on ST3 build 3116+ and you must enable the feature in the settings file.

popup

6 Likes

#49

There was a small bug in the mdpopups dependency that would prevent the popup from opening sometimes. If you are having this issue PackageControl might not have updated your mdpopups. You can force it by running the Package Control command ‘Satisfy Dependencies’ which should pull the latest mdpopups. Restart Sublime afterwards.

0 Likes

#50

Okay, there were a couple more fixes to mdpopups related to language map handling.

The latest recommended mdpopups is 1.5.0. You can check in the console with:

>>> import mdpopups;mdpopups.version()
(1, 5, 0)

If you don’t have 1.5.0, I would run Satisfy Dependencies from the quick panel. Anyways, I think I’ve found all the critical bugs. I guess now we wait and see :).

0 Likes

#51

BracketHighlighter is missing from Package Control :(. It appears to be a Package Control issue. @wbond any idea why this suddenly occured?

0 Likes

#52

Update on the Missing Package Debacle

For those concerned about the mysterious disappearance of BracketHighlighter from Package Control, you can follow the progress of resolution here:

Basically there is nothing I can do until someone can tell me that I did something wrong recently that broke it, or the issue is resolved on Package Control. Anyone who is interested in trying the recent version, or just needs to do a fresh install will probably have to just install manually. Wbond has said he will look into to it probably tomorrow on the Package Control side.


How to install manually

  1. Download the latest tag from here: https://github.com/facelessuser/BracketHighlighter/releases.
  2. Unpack the zip into your Packages folder (renaming the folder from BracketHighlighter-st3-0.0.0 to just BracketHighlighter).
  3. Run Package Control’s Satisfy Dependencies command to get all the dependencies
  4. restart Sublime

Installing with git is also nice an option if you are comfortable with git, but you would still need to do steps 3 and 4.


It is our hopes that BracketHighlighter will be returned to us safe and sound.

0 Likes

#53

BracketHighlighter is back up. The issue was that Package Control breaks if you have too many tags. This needs to be fixed, but I was able to workaround the issue for now by deleting old tags.

2 Likes

#54

Yes, it seems we’ve discovered that at some point GitHub paginates the list of tags. There will need to be a patch in Package Control and packagecontrol.io to prevent this from happening in the future.

2 Likes

#55

Is there any way to get Bracket Highlighter to use the same colors as defined in the color scheme in the popup it shows?

I think it is currently based on individual scopes? but color schemes can define rules based on scope selectors, not just individual scopes…


Also, it would be great if we could configure how many leading and trailing lines are shown in the popup (currently 0), sometimes the bracket is on it’s own line and thus has no context, which is the main point of the popup really, to show context… (Maybe it would only be necessary to show other lines when the bracket is the only thing on the line, excluding whitespace.)


I hope it will stick around, I really like it and once it has the aforementioned improvements, I think it will be invaluable :slightly_smiling:

1 Like