Home Download Buy Blog Forum Support

BracketHighlighter

Re: BracketHighlighter

Postby facelessuser on Sun Mar 18, 2012 2:25 pm

C0D312 wrote:That was fast. I, personally, don't like it. Makes the gutter too busy; however, I'm impressed that it only took you a couple of minutes to implement.


When you know the code well, stuff like this is trivial.

I agree though that it doesn't look good. At least not to me.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby facelessuser on Sun Mar 18, 2012 7:00 pm

Though it was a fun exercise, I think I will hold off on adding the line between brackets. I can add it without affecting people that don't like it, but it does seem unneeded with the current ST2 indentation highlight option. Notepad++ only does the line on foldable regions, and the indentation option in ST2 does the same. So I think what was being asked here is already accomplished in ST2.

I would have to get a lot of people asking for this to support such an option.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby vitaLee on Sun Mar 18, 2012 7:28 pm

i have question regarding tag matching.
does it make sense to you to match tags when the cursor is between tags?
like:
<> | <div>
| |
<> | </div>
currently div tags are matched when cursor is within either one of the opening/closing tags
<>| <div | >
<>| </div>
vitaLee
 
Posts: 150
Joined: Tue Dec 27, 2011 11:10 pm

Re: BracketHighlighter

Postby C0D312 on Sun Mar 18, 2012 7:36 pm

vitaLee wrote:i have question regarding tag matching.
does it make sense to you to match tags when the cursor is between tags?
like:
<> | <div>
| |
<> | </div>
currently div tags are matched when cursor is within either one of the opening/closing tags
<>| <div | >
<>| </div>

+1
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: BracketHighlighter

Postby facelessuser on Sun Mar 18, 2012 8:24 pm

vitaLee wrote:i have question regarding tag matching.
does it make sense to you to match tags when the cursor is between tags?
like:
<> | <div>
| |
<> | </div>
currently div tags are matched when cursor is within either one of the opening/closing tags
<>| <div | >
<>| </div>


It makes since, but it is not as easily done. I am kind of doing what I believe ST2 does, first I use the angle bracket matching to find a potential tag, then I see if it is a tag (opening or closing) and then I look for the pair if it is a tag. If you put a cursor in here:

<string>([\w\-]+)\s*(:)\s*</string>

Do you match the bracket or the tag?


If I added something like this I might take this approach if I find a bracket match before I find a tag, don't search for tag, if I find a tag before I find a bracket match, then highlight the tags. That way in the above example, if I were inside the brackets, the tag does not get matched, but if I am outside the brackets, then the tags would get matched.

Let me play around with this.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby vitaLee on Sun Mar 18, 2012 8:43 pm

i was thinking the same.
match the first bracket you find in either direction, that's why it's called BracketHighlighter :)
vitaLee
 
Posts: 150
Joined: Tue Dec 27, 2011 11:10 pm

Re: BracketHighlighter

Postby facelessuser on Sun Mar 18, 2012 9:24 pm

vitaLee wrote:i was thinking the same.
match the first bracket you find in either direction, that's why it's called BracketHighlighter :)


Its just fitting it into the algorithm is a little tricky. It was streamlined to do it one way, but to do it the way you are suggesting may take me a while to do well (if I get it working good at all). Also, it is not on the top of my list of things to do since it would also be big headache to make happen.

What I plan to do in the next week is to resolve my current issue with strings:
- I don't like that I am wasting time detecting regex conventions for different languages in strings, and I think it is silly I am highlighting "/" in regex strings. So I am thinking I want to only highlight quoted strings, but still allow the searching for and highlighting of internal string brackets in any non-quoted strings. If no brakcets are found in a non-quoted string, I want to ignore the string and find the next parent bracket. It would be a more generic support for brackets inside any string, and it would support more languages.
- This could also apply to people who don't want to highlight quotes, but still like to highlight brackets inside strings.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby facelessuser on Thu Mar 22, 2012 2:54 am

Version 1.7
- Hide parent quote highlighting when child quotes are highlighted
- Allow the searching for brackets in non-quoted code scoped as strings (like regex)
- Add setting "highlight_string_brackets_only" which allows never highlighting quotes but leaves internal string bracket highlighting on
- deprecate "enable_forward_slash_regex_strings" in favor of "find_brackets_in any_strings"

Hopefully that all makes sense, basically I just made some tweaks to string highlighting and allow for string bracket highlighting now to occur in any string scope.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter

Postby peppy on Tue Mar 27, 2012 7:24 am

Forgive me if this has been mentioned, but I'd find it epically cool and useful to have multiple bracket types highlighted at once (with only one insertion point) like this:

Image
peppy
 
Posts: 52
Joined: Thu Aug 04, 2011 4:52 pm
Location: perth, australia

Re: BracketHighlighter

Postby facelessuser on Tue Mar 27, 2012 4:39 pm

peppy wrote:Forgive me if this has been mentioned, but I'd find it epically cool and useful to have multiple bracket types highlighted at once (with only one insertion point) like this:

Image


The problem is, BracketHighlighter is designed to minimize how much time it is searching to give you pretty instant highlighting without bogging down your editor. By doing what you suggest, you would have to keep crawling back looking for even more brackets; this would take more time on every search.

Also, I think it would make things more cluttered. The point of BracketHighlighter is to quickly show you what block you are in, but if all the blocks get highlighted, it is not nearly as effective at quickly showing you were you are.

Though opinion may differ on this point, I do not foresee this becoming an addition to BracketHighlighter, but thanks for your interest.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 16 guests