Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Scheme doesn't color correctly #9

Closed
lee-hyunkyu opened this issue Jan 18, 2018 · 11 comments
Closed

Color Scheme doesn't color correctly #9

lee-hyunkyu opened this issue Jan 18, 2018 · 11 comments

Comments

@lee-hyunkyu
Copy link

Here's a quick example. While some things work correctly, other things don't.

I'm currently running Sublime Build 3143 and it is a clean install.

screen shot 2018-01-16 at 4 30 37 pm

@arcticicestudio
Copy link
Contributor

Related to #3

Can you try to follow the official instructions to reset the application state and see if it fixes the problem? Make sure to backup your preferences before otherwise these will be removed and lost!

@lee-hyunkyu
Copy link
Author

I've reset the application state and reinstalled the application. The nord-sublime-text repo is the only thing inside my Packages folder. Perhaps I'm behind? I should be on the develop branch right? The latest commit I see inside the local repository is a merge with commit hash "0f1657daa79797ad9cd1e3caa92e2cb277571b0b".

@arcticicestudio
Copy link
Contributor

arcticicestudio commented Jan 19, 2018

I'm using Build 3152 and I was not able to reproduce the problem even after resetting the app state the theme gets loaded correctly. Can you please try to reproduce it using Build 3150 or higher which includes a improvement to color scheme reloading.

BUILD 3150
17 October 2017

  • ...
  • Improved color scheme reloading
  • ...

@lee-hyunkyu
Copy link
Author

Unfortunately I’m not a registered user so I cannot use the dev builds.

@lee-hyunkyu
Copy link
Author

lee-hyunkyu commented Jan 19, 2018

@arcticicestudio Resolved. I figured out the issue. In case you're interested this is one of your rules in the color scheme. The scope value seems to need to be one line for Build 3143. I can't test this with another computer but changing this.

<dict>
        <key>name</key>
        <string>[CSS/Sass] At-Rule</string>
        <key>scope</key>
        <string>
          source.css keyword.control.at-rule.media.css,
          source.css punctuation.definition.keyword.css,
          source.sass keyword.control.at-rule.sass
        </string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#d08770</string>
        </dict>
</dict>

to this

<dict>
        <key>name</key>
        <string>[CSS/Sass] At-Rule</string>
        <key>scope</key>
        <string> source.css keyword.control.at-rule.media.css, source.css punctuation.definition.keyword.css, source.sass keyword.control.at-rule.sass </string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#d08770</string>
        </dict>
</dict>

fixed all issues for me. If you want to make the fix yourself, the regex to match this is <key>scope</key>.*\n.*<string>.*\n(.*,\n)+(.*)\n.*</string> and I made a small fork that does this conversion for all matches. I'll leave the issue open for now in case you want to leave this for others who don't have the dev builds.

@arcticicestudio
Copy link
Contributor

Thanks for the detailed troubleshooting 👍
So it seems like they changed the way the theme handles newlines \n within the key/scope definitions. I've used newlines to make the theme code more readable and clearer, and to keep within the maximum line length of 120 characters.

If there's not way to make the theme compatible between different versions I'm forced to change all these lines.

@lee-hyunkyu
Copy link
Author

A workaround that I have found is to simply separate all of the different scopes. For example:

Change this

<dict>
        <key>name</key>
        <string>[Storage] Type</string>
        <key>scope</key>
        <string>storage.type, storage.modifier</string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#81a1c1</string>
        </dict>
</dict>

into this

<dict>
        <key>name</key>
        <string>[Storage] Type</string>
        <key>scope</key>
        <string>storage.type</string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#81a1c1</string>
        </dict>
</dict>

<dict>
        <key>name</key>
        <string>[Storage] Type</string>
        <key>scope</key>
        <string>storage.modifier</string>
        <key>settings</key>
        <dict>
          <key>foreground</key>
          <string>#81a1c1</string>
        </dict>
</dict>

It'll make your color scheme file much (much) longer, but the fact that the name value is the same doesn't seem to affect the coloring of text. This will probably allow you to keep your maximum line length to be 120 characters but this may make the theme code harder to read quickly. I'll try to see if there's a better workaround.

@lee-hyunkyu
Copy link
Author

The sublime text version (build 3170) now available for non-license users supports new line characters inside the string tags and fixes this bug.

@arcticicestudio
Copy link
Contributor

@lee-hyunkyu Thanks for the info 👍 Haven't got the time to work on this issue, but it's good that they fixed it within Sublime itself so I don't have to change it to a ugly workaround. I'll add this issue to the backlog to add it to the documentation.

@arcticicestudio
Copy link
Contributor

@lee-hyunkyu Just want to let you know that the initial release has finally been pushed to the registry 😄
See #16 (comment) for more details.

@lee-hyunkyu
Copy link
Author

@arcticicestudio I saw! Thanks for all your hard work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants