Home Download Buy Blog Forum Support

BracketHighlighter2 BETA Branch

Re: BracketHighlighter2 Alpha Branch

Postby Gnintendo on Sun Oct 28, 2012 10:05 pm

I was envisioning just picking the outermost scope for the coloring. Regarding the braces, I like the white coloring that matches. The matching colors are the least distracting while still being useful with a flare of style. Is there an easier way to do this than manually go and set the color to match for every single "bracket" type?
Gnintendo
 
Posts: 9
Joined: Fri Oct 26, 2012 11:26 pm

Re: BracketHighlighter2 Alpha Branch

Postby facelessuser on Sun Oct 28, 2012 10:34 pm

Gnintendo wrote:I was envisioning just picking the outermost scope for the coloring. Regarding the braces, I like the white coloring that matches. The matching colors are the least distracting while still being useful with a flare of style. Is there an easier way to do this than manually go and set the color to match for every single "bracket" type?


Some people want one color that all brackets use, some people want the bracket to be the same as the bracket being emphasized, some want contrast between the two to make it easier to see. I run into a problem were I can't please everyone with styling, so the easiest way is to make it completely configurable. If I make it simpler for you to style it in your way, it may make it less simpler for people to style in their way. So I make it basic, but straight forward. Create style profiles and assign them to one or more brackets.

You don't have to create separate style profiles for every bracket. You can create just a couple and assign them to multiple brackets. You can remove them all and just use the default one.

On top of that, changing the colors isn't something you are going to be doing everyday. It is one of those things were you tweak it the first time, and then you forget about it. If it was a task that was going to be done everyday, I can see where it would get troublesome, but really, this is something you should tweak how you like and forget about it.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter2 Alpha Branch

Postby Gnintendo on Sun Oct 28, 2012 11:38 pm

facelessuser wrote:
Gnintendo wrote:I was envisioning just picking the outermost scope for the coloring. Regarding the braces, I like the white coloring that matches. The matching colors are the least distracting while still being useful with a flare of style. Is there an easier way to do this than manually go and set the color to match for every single "bracket" type?


Some people want one color that all brackets use, some people want the bracket to be the same as the bracket being emphasized, some want contrast between the two to make it easier to see. I run into a problem were I can't please everyone with styling, so the easiest way is to make it completely configurable. If I make it simpler for you to style it in your way, it may make it less simpler for people to style in their way. So I make it basic, but straight forward. Create style profiles and assign them to one or more brackets.

You don't have to create separate style profiles for every bracket. You can create just a couple and assign them to multiple brackets. You can remove them all and just use the default one.

On top of that, changing the colors isn't something you are going to be doing everyday. It is one of those things were you tweak it the first time, and then you forget about it. If it was a task that was going to be done everyday, I can see where it would get troublesome, but really, this is something you should tweak how you like and forget about it.

I know, I was just asking if there was an easier way to do this (eg. somehow set it as the default behavior for everything). Nothing can ever please everybody; I just thought this would be a nice option to have and a better default than simply using the foreground color. I'm not suggesting you should abandon customization, that's silly. I'm just saying that something like:
Code: Select all
"default": {
    "color": "brackethighlighter.bracketcolor",
}
would be a nice option to have.
Gnintendo
 
Posts: 9
Joined: Fri Oct 26, 2012 11:26 pm

Re: BracketHighlighter2 Alpha Branch

Postby facelessuser on Sun Oct 28, 2012 11:49 pm

Gnintendo wrote:
facelessuser wrote:
Gnintendo wrote:I was envisioning just picking the outermost scope for the coloring. Regarding the braces, I like the white coloring that matches. The matching colors are the least distracting while still being useful with a flare of style. Is there an easier way to do this than manually go and set the color to match for every single "bracket" type?


Some people want one color that all brackets use, some people want the bracket to be the same as the bracket being emphasized, some want contrast between the two to make it easier to see. I run into a problem were I can't please everyone with styling, so the easiest way is to make it completely configurable. If I make it simpler for you to style it in your way, it may make it less simpler for people to style in their way. So I make it basic, but straight forward. Create style profiles and assign them to one or more brackets.

You don't have to create separate style profiles for every bracket. You can create just a couple and assign them to multiple brackets. You can remove them all and just use the default one.

On top of that, changing the colors isn't something you are going to be doing everyday. It is one of those things were you tweak it the first time, and then you forget about it. If it was a task that was going to be done everyday, I can see where it would get troublesome, but really, this is something you should tweak how you like and forget about it.

I know, I was just asking if there was an easier way to do this (eg. somehow set it as the default behavior for everything). Nothing can ever please everybody; I just thought this would be a nice option to have and a better default than simply using the foreground color. I'm not suggesting you should abandon customization, that's silly. I'm just saying that something like:
Code: Select all
"default": {
    "color": "brackethighlighter.bracketcolor",
}
would be a nice option to have.

That is what I was saying earlier. That already exists. It just isn't dynamic (grap the actual scope of the bracket).

It makes it tough because the region has to be the same for all in the group, so you can't really scan every bracket selection, or you would have to create a special region for every bracket instead of bracket groups, and ensure the region key names don't overlap and then keep a list so you can clear them all. It is a lot of added complexity.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter2 Alpha Branch

Postby Gnintendo on Mon Oct 29, 2012 12:35 am

So then how do I use the existing non-dynamic approach? I'm not sure I fully understood what you were getting that, then.
Gnintendo
 
Posts: 9
Joined: Fri Oct 26, 2012 11:26 pm

Re: BracketHighlighter2 Alpha Branch

Postby facelessuser on Mon Oct 29, 2012 1:26 am

Take a look at the current settings. I only define one color in default. The rest of them inherit that color. You can see I have colors commented out in the others. If you uncomment them (and the scope actually exists) those style definitions will pick up the new style. The easiest way to understand is to take a look and turn some of those knobs.

It is the eternal problem of not giving people enough knobs to turn vs giving them too many. People wanted it to be configurable for every thing they wanted, the down side is that now you have to turn all of those knobs to get what you want :).
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter2 Alpha Branch

Postby Gnintendo on Mon Oct 29, 2012 1:46 am

Can you define the defaults when something isn't specified in the User settings file?
For instance, when I do this in my user settings:
Code: Select all
{
  "bracket_styles": {
    "unmatched": {
      "color": "brackethighlighter.unmatched",
      "style": "underline"
    },
    "curly": {
      "color": "brackethighlighter.curly"
    },
    "round": {
      "color": "brackethighlighter.round"
    },
    "square": {
      "color": "brackethighlighter.square"
    },
    "angle": {
      "color": "brackethighlighter.angle"
    },
    "tag": {
      "color": "brackethighlighter.tag",
      "style": "underline"
    },
    "single_quote": {
      "color": "brackethighlighter.quote"
    },
    "double_quote": {
      "icon": "double_quote",
      "color": "brackethighlighter.quote"
    },
    "regex": {
      "color": "brackethighlighter.quote"
    }
  }
}

All the icons are the circle except the double_quote when I manually copied in. Shouldn't this be falling back on the default values for that particular setting when I don't specify what I want?

On a side note, I guess there's no easy way to simply grab the coloring of the outermost character highlighted/underlined/outlined/etc to use. Oh well. :(
Gnintendo
 
Posts: 9
Joined: Fri Oct 26, 2012 11:26 pm

Re: BracketHighlighter2 Alpha Branch

Postby facelessuser on Mon Oct 29, 2012 2:30 am

Gnintendo wrote:Can you define the defaults when something isn't specified in the User settings file?

I explain this in the settings file.

        // "default" and "unmatched" styles are special
// styles. If they are not defined here,
// they will be generated internally with
// internal defaults.

// "default" style defines attributes that
// will be used for any style that does not
// explicitly define that attribute. So if
// a style does not define a color, it will
// use the color from the "default" style.
"default": {
"icon": "dot",
"color": "brackethighlighter.default",
"style": "underline"
},


If you do not define the default style I define one internally.

Attributes from "default" is what gets used when you don't define an attribute in another style. So in your example, you did not define an icon, so the default one got used. But you also did not define a default style, so the plugin used the internal one which defines the icon as "dot".

Gnintendo wrote:All the icons are the circle except the double_quote when I manually copied in. Shouldn't this be falling back on the default values for that particular setting when I don't specify what I want?


I don't understand what you are expressing here. See the above response which explains the behavior. It is acting as intended.

Gnintendo wrote:On a side note, I guess there's no easy way to simply grab the coloring of the outermost character highlighted/underlined/outlined/etc to use. Oh well. :(

It could be done, but it causes a lot more complexity to an already complex set of rules. Take a look at the actual code, you will see to make it as configurable as it is now, there is quite a bit of complexity. What you propose would require yet another exception, and impact a lot of code. It would require me to dynamically create a region for each individual bracket opposed to bracket groups as it is done now. And if I added it, someone would then not be satisfied that it picks the first scope, but want maybe the last scope etc...I don't want to open that box. But I do appreciate the feedback. Certain features I push back on because I have to maintain this code, so no offense :).
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: BracketHighlighter2 Alpha Branch

Postby iamntz on Mon Oct 29, 2012 5:25 am

Thanks for the update! Just finished migrating my old settings, no biggie, like 10 minutes of work (i think 8 minutes took to figure out how new stuff works :D )

Few stuff:
- it is possible to extend a theme? I mean ok, i changed Monokai, but what if there is a new version of Monokai in the future? (is totally unrelated to BH, it's more related to ST itself).

- i noticed that if i would remove everything and let this empty in my user bb_core settings file:
Code: Select all
"scope_brackets": []

Highlights stops for quotes. If i remove completely, it's fine (which is what i did). I'm not customizing anything in this area (not now, probably not ever), but probably it's a good idea to have an option to merge settings with default or just replace completely. That's because it's kinda silly to copy/paste ALL default settings just to add one more setting. Again, i'm not using this, but probably someone that use it should provide some feedback.

- i read in another thread about alpha colors. Which i tried and works awesome. There are some situations when text cursor it's slightly hard to see (when you use style:solid). I was thinking of adding an option to „dim the solid color” when you are touching a bracket with the cursor ( like so {|} ). In this case, if the color is #CC0000, when touching would be #CC000066 or something like that. Make sense?

- another thing that may be useful (ask other users too!) is to not highlight brackets that are touching ( e.g. in: function(){ }, () part should not be highlighted, but {} should be)

Pfiew, that's all for now. I woke up in a typing mood! :mrgreen:
iamntz
 
Posts: 907
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: BracketHighlighter2 Alpha Branch

Postby facelessuser on Mon Oct 29, 2012 1:37 pm

iamntz wrote:Few stuff:
- it is possible to extend a theme? I mean ok, i changed Monokai, but what if there is a new version of Monokai in the future? (is totally unrelated to BH, it's more related to ST itself).

Not sure. I don't think you can, but I could look into it. I usually copy my color schemes to a sub folder in my user folder so ST2 will not overwrite my personal edits.

iamntz wrote:- i noticed that if i would remove everything and let this empty in my user bb_core settings file:
Code: Select all
"scope_brackets": []

Highlights stops for quotes. If i remove completely, it's fine (which is what i did). I'm not customizing anything in this area (not now, probably not ever), but probably it's a good idea to have an option to merge settings with default or just replace completely. That's because it's kinda silly to copy/paste ALL default settings just to add one more setting. Again, i'm not using this, but probably someone that use it should provide some feedback.

Yeah, that is how ST2 loads settings files via sublime.load_settings. If I do a custom deep merge solution, I have to start watching files for changes and reload etc. like ST2 does...it is not really worth it. ST2 already does all of this, it just does a shallow merge (the user key overwrites the base key), just something you have to be aware of.

iamntz wrote:- i read in another thread about alpha colors. Which i tried and works awesome. There are some situations when text cursor it's slightly hard to see (when you use style:solid). I was thinking of adding an option to „dim the solid color” when you are touching a bracket with the cursor ( like so {|} ). In this case, if the color is #CC0000, when touching would be #CC000066 or something like that. Make sense?

Makes sense. I would do this if ST2 would only directly accept a color via the API, but since it doesn't, the only way to accomplish this is to require the user to make a separate dimmed color profile, and based on some internal rule pick between the two color profiles.

iamntz wrote:- another thing that may be useful (ask other users too!) is to not highlight brackets that are touching ( e.g. in: function(){ }, () part should not be highlighted, but {} should be)

I could do this if enough people wanted it. Basically you want to ignore a bracket if the two brackets touch each other? The only issue I see though, is that it might be annoying for some types of brackets. For instance, tags have bracket plugins that allow you select the tag names of both opening and closing tags so you can edit them both. So if you created a tag, but you decided to change their name (and the tags touched), the plugin wouldn't work. Anything I do, I want to make very general so it works with all brackets. I don't want to hard code things specifically for tags etc. Also things like swap tags would break etc. (I know it isn't working right now, but when I finish it, it would break on this for touching brackets).
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 5 guests