You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since packages (and thus grammars) are loaded async, when a new grammar is added, Atom checks all open files to see if the new grammar should trump the one it currently has.
The addition of injectionSelector seems to cause this process to short circuit. I can't seem to find much documentation for how injectionSelector is supposed to be used, but I it looks to me (based on the Atom code and this discussion) like it's only intended for grammars that apply to scopes, not entire files.
My apologies, I believe that is a bug. My forum question was answered by @50Wliu, and I got the impression it was a property designed to inject the current grammar into another when the other gained the specified scope. For example, the ideal use case in a Markdown file is when the user types
```js
```
Using injectionSelector, the code within the code block will get proper syntax highlighting. I got no impression it was solely for grammars for scopes.
However, there is a workaround that has the same effect as the embedding, but without this bug. Making a new grammar file (e.g., called embeddedBabel.json) and filling it out like so:
If you (re)start Atom with some JS files already open,
Babel ES6 JavaScript
does not get applied.Regressed here: #473
Since packages (and thus grammars) are loaded async, when a new grammar is added, Atom checks all open files to see if the new grammar should trump the one it currently has.
https://github.com/atom/atom/blob/1dc700182171ae2fe8773bed703a62104aad0b8e/src/grammar-registry.js#L330
The addition of
injectionSelector
seems to cause this process to short circuit. I can't seem to find much documentation for howinjectionSelector
is supposed to be used, but I it looks to me (based on the Atom code and this discussion) like it's only intended for grammars that apply to scopes, not entire files.CC @wbinnssmith @Aerijo @gandm
The text was updated successfully, but these errors were encountered: