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

How to get same color scheme as babel-sublime? #22

Closed
dortamiguel opened this issue Mar 3, 2018 · 2 comments
Closed

How to get same color scheme as babel-sublime? #22

dortamiguel opened this issue Mar 3, 2018 · 2 comments

Comments

@dortamiguel
Copy link

Babel sublime looks like this
image

And JS Custom - React looks like this
image

I want to get the same orange imports and dots on JS Custom, is this possible?

JS code that I used for this example

import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
@dortamiguel dortamiguel changed the title How to get same color scheme as babel-sublime How to get same color scheme as babel-sublime? Mar 3, 2018
@Thom1729
Copy link
Owner

Thom1729 commented Mar 3, 2018

babel-sublime highlights several syntax features differently from the core JavaScript syntax. (JS Custom inherits the core highlighting except where an extension deliberately overrides it.)

In some cases this is a matter of subjective preference. For instance, babel-sublime highlights unquoted object keys as string.unquoted. This is arguably more correct, and the core JavaScript syntax briefly used the same implementation, but the backlash from users used to the prior highlighting convinced them to revert the change. JS Custom offers an option, string_object_keys, to allow users to satisfy either preference.

In other cases babel-sublime does not follow the standard practices used by most other syntaxes. (These practices are documented in the official scope naming guidelines, but these guidelines are not comprehensive. A community effort to formalize more specific guidelines is in its early stages.) For example, babel-sublime highlights the dot (foo.bar) as keyword.operator.accessor. However, the standard convention is to use punctuation.accessor (as seen in the core syntaxes, including JavaScript, and inherited by JS Custom). babel-sublime also highlights import and from as keyword.operator, which is definitely incorrect. In theory, JS Custom could provide extensions that mirror babel-sublime's behavior here, but I am hesitant to do that because, in contrast to the issue with unquoted object keys, babel-sublime really is in the wrong here.

But if you like the appearance of babel-sublime, there's no reason you can't recreate it with JS Custom. What I'd recommend is extending your color scheme. Save the following as Packages/User/Mariana.sublime-color-scheme:

{
    "rules": [
        {
            "scope": "keyword.operator.word, keyword.control.import-export",
            "foreground": "var(red2)"
        },
    ]
}

If there are more highlighting differences that you'd like to change to resemble babel-sublime, I'd be happy to help. It's likely that other users may be used to the babel-sublime appearance and would benefit from a ready-made patch.

@dortamiguel
Copy link
Author

Awesome! It works for the import and export

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

No branches or pull requests

2 participants