borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
558 stars 18 forks source link

Object's fields have suspicious color #176

Closed YuriGor closed 5 years ago

YuriGor commented 5 years ago

test code:

var obj = {
  hi:"there",
  count:0,
  really:true,
  mean:undefined,
  nono:null,
  method:function(){}
};

first lets look at native JS syntax monokai: image candyman: image field names are nearly white, let's say it's a basic text color And this is Naomi monokai: image candyman: image in monokai it same as string constants in candyman I am not sure what does this color mean. Was this made intentionally? In monokai this looks not very good with large objects filled with strings: image everything is yellow, not very readable.

YuriGor commented 5 years ago

Also I found same issue in the babel repo: https://github.com/babel/babel-sublime/issues/352 and with marianna scheme there is same problem native js: image Naomi: image

borela commented 5 years ago

This was intentionally, Naomi marks then as:

meta.object-literal.js.fjsx15
meta.block.js.fjsx15
meta.object-literal.key.js.fjsx15
string.unquoted.js.fjsx15

While the native syntax only does:

meta.object-literal.js
meta.object-literal.key.js

This was intentional in Naomi because it keeps the syntax compatible with most color schemes that like Candyman gives a different color to object literal keys, in fact, on the build system's branch I changed the keys colors to a light brown to distinguish better the key from types in code that has a lot of Flow annotations:

image

The way the native syntax scopes the keys, makes it imposible to color it without affecting other key types.

borela commented 5 years ago

If you add a rule to your color scheme targeting the scopes:

meta.object-literal.key
string.unquoted

You'll be able to use any color in there without the risk of affecting the values.

YuriGor commented 5 years ago

So it's more like monokai's issue. I added scope as you suggested, it works, thank you.

borela commented 5 years ago

No problem, if you have any questions, feel free to open new issue reports :D