fnky / behave-theme

A theme that makes you happy like cats on the internet, and Morgan Freeman's sexy voice.
MIT License
89 stars 11 forks source link

Does not seem to properly style braces, parens, periods, etc in Java #8

Closed gilbertw1 closed 8 years ago

gilbertw1 commented 9 years ago

Hi,

I really really enjoy using your theme. One minor issue I've bumped into when writing Java using this theme is that miscellaneous separator characters (semicolon, period, parens, braces) appear as green and blend in with much of the other code. I'm not sure if this is intentional, but I'm assuming not since other languages do not style these characters this way.

Here's a quick picture to illustrate what I'm talking about:

screen shot on 2015-04-13 at 10-59-30

This isn't a huge deal, just a very minor annoyance. I've tried mucking around a bit to fix it myself, but haven't had much luck as I'm not very familiar with these theme files.

Thanks!

fnky commented 9 years ago

This is an issue ewith how Java syntax is, not the color scheme. A color scheme simply styles on selectors, which is in change is made by a syntax using regular expression. If there's no selector for parentheses, semicolons, etc. It's not possible to style those.

gilbertw1 commented 9 years ago

Ah gotcha. I'd just assumed it was an issue with the theme since most other themes seemed to differentiate these characters properly. I'll do some poking around.....thanks for the quick response!

fnky commented 9 years ago

I will see what I can do. If you find anything interesting keep me updated :-)

gilbertw1 commented 9 years ago

After some trial and error, I narrowed the offender down to 'meta.method' in the following block:

    <dict>
        <key>name</key>
        <string>Function, Special Method, Block Level</string>
        <key>scope</key>
        <string>entity.name.function, meta.function-call, support.function, keyword.other.special-method, meta.method, meta.accessor, meta.block-level, function.name</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#61d29d</string>
        </dict>
    </dict>

Apparently in the java tmLanguage file, meta.method refers to the entire method including everything included in it's entire body (reference here). After removing 'meta.method', the same snippet looks like this:

screen shot on 2015-04-13 at 16-31-19

I'm not sure how this will affect other languages, but I'm not noticing any specific changes for the languages I normally use. If there are detrimental effects they could possibly be worked around by using the specific method elements that need to be styled (a la meta.method.{somethingspecific}).

Thanks again for your quick responses!

fnky commented 9 years ago

Hmm, it seems as if the variables/properties doesn't get coloured, otherwise nice find :-)

gilbertw1 commented 9 years ago

Right, and given my experience with Java + various themes in the past is that Java syntax highlighting always comes out a bit boring. Looking at the tmLanguage file for it, it appears that it doesn't export too terribly many scopes. I think the only way to get proper highlighting on variables would require enhancing the tmLanguage file. But at least this change prevents the entirety method body from being colored green.

The boring syntax highlighting support is probably a reflection on the boring nature of the language itself :)

hiepnhl commented 9 years ago

Does this color scheme only support js?

fnky commented 9 years ago

@gilbertw1 You're probably right. Could you make a pull request? This way I have a better log for changes and collaborators :-)

@hiepnhl I have tried to support all languages, including extended syntaxes like JavaScript Babel, etc. But some languages might be broken.

gilbertw1 commented 9 years ago

Created pull request: #9

Thanks again for the quick feedback and awesome theme :)

fnky commented 9 years ago

Can you checkout fix-java and change the Java Methods block on line 143? I have also commented on #9 with an explanation.

The branch also fixes minor syntax coloring for strings.

gilbertw1 commented 9 years ago

Just created pull request #10

Made a few more minor changes to match a few more method elements.