Comments (2)
I dug into this, and the Monokai rule is:
{
"name": "Tag name",
"scope": "entity.name.tag | meta.mapping.key string.unquoted",
"foreground": "var(red2)"
},
So the current version of Monokai is deliberately targeting things like JS object keys and highlighting them red. I checked the last ST3 release and the rule is different:
{
"name": "Tag name",
"scope": "entity.name.tag",
"foreground": "var(red2)"
},
So this is a deliberate change in the core Monokai syntax, not a regression in babel-sublime. Granted, it is a visible change in behavior for babel-sublime/Monokai users.
It would be possible to restore the yellow color by removing the meta.mapping.key
scope. This would have to be done by modifying JS Custom's string_object_keys
extension. From the look of it, it would be a fairly intrusive change because the meta.mapping.key
scope is applied at a higher level.
On the other hand, there's an easy workaround: if you use Monokai, and you prefer the old highlighting, then you can customize Monokai with an added rule:
{
"name": "JS object bare key",
"scope": "meta.mapping.key string.unquoted.js",
"foreground": "var(yellow)"
},
The babel-sublime v10 rewrite went out of its way to preserve the original highlighting of bare keys a) to make the v9–v10 transition more seamless for users, b) to reduce the number of highlighting changes to make regressions more visible, and c) because the string.unquoted
scope is arguably more correct than the core syntax's scoping. The string_object_keys
extension is small and unintrusive, so it wasn't a big deal to add.
On the other hand, this change a) is due to a change in Monokai and is not a regression in babel-sublime, b) would have happened in v9 anyway, c) would be fairly intrusive to change, and d) might make highlighting worse in non-Monokai color schemes. In addition, Sublime Text 4 makes it easy to tweak color schemes and even offers a built-in command for doing so (“UI: Customize Color Scheme”).
Therefore, I'm not inclined to change babel-sublime to restore the yellow highlighting under Monokai, and at some point I should update the example images in the readme to reflect the current version of Monokai. But I'm available if anyone needs help tweaking their color scheme.
from babel-sublime.
Thanks for looking into this @Thom1729!
For the reference of anyone else that decides to use the workaround, here are the steps I followed:
- Create the file
~/Library/Application Support/Sublime Text/Packages/User/Monokai.sublime-color-scheme
- Add the following contents:
{
"rules": [
{
"foreground": "var(yellow)",
"name": "JS object bare key",
"scope": "meta.mapping.key string.unquoted.js"
}
]
}
from babel-sublime.
Related Issues (20)
- Babel issue HOT 1
- Inline comments breaking if comment begins with @ symbol HOT 5
- Version 11 broke syntax highlighting. HOT 15
- Object keys highlighting slightly incorrect in recent release HOT 5
- Question on how to short-circuit on ``` for fenced code blocks in Markdown HOT 5
- Sublime 4 Crashing HOT 4
- Possible highlighting error using a nested ternary HOT 3
- Highlighting error not using parentheses inside an if condition HOT 7
- Error loading syntax file: 'Packages/Babel/JavaScript (Babel).sublime-syntax' HOT 18
- ST4 Autocomplete does not consider state variables defined in a map HOT 1
- Missing Babel option in syntax selector. HOT 2
- Highlighting of `filter` in `styled-components` seems to break— HOT 3
- css Styled Component helper utility improperly highlighted HOT 3
- Functions with parameters on multiple lines are not highlighted properly. HOT 1
- JS #myPrivateClassMethod() breaks syntax highlighting HOT 6
- Sublime 4149 generates "Error loading syntax file[...]: no such target" pop-up for "JavaScript (Babel)" HOT 3
- Interface in extends class is not well Colored HOT 4
- Object literal property has incorrect color in Sublime 4169
- support html`<b>babel</b>` html syntax in templates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-sublime.