nordtheme / sublime-text

An arctic, north-bluish clean and elegant Sublime Text theme.
https://www.nordtheme.com/ports/sublime-text
MIT License
140 stars 12 forks source link

Color Scheme doesn't color correctly #9

Closed lee-hyunkyu closed 6 years ago

lee-hyunkyu commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

lee-hyunkyu commented 6 years ago

@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 commented 6 years ago

Thanks for the detailed troubleshooting :+1: 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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@lee-hyunkyu Thanks for the info :+1: 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 commented 5 years ago

@lee-hyunkyu Just want to let you know that the initial release has finally been pushed to the registry :smile: See https://github.com/arcticicestudio/nord-sublime-text/issues/16#issuecomment-518970846 for more details.

lee-hyunkyu commented 4 years ago

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