Use of source.jsx scope for react
bcomnes opened this issue · 5 comments
Looks like ST4 now supports a scope: source.jsx
for JSX containing files. It mainly sets up a custom jsx file icon. Should the react JSCustom config start using that scope instead?
A few more breadcumbs for this idea:
I manually edited the generated react sytax for jscustom to use the jsx scope, and everything worked fine as expected.... except my jslinters stopped working on source.jsx
views.
Easy enough to customize that, though it sounds like maybe they need to add some additional default scopes to work well with the jsx target as well.
My issue over on js linters for context SublimeLinter/SublimeLinter-eslint#307
The only drawback when manually editing the generated syntax scope is that regenerating the syntax just overrides any customization. Any idea on how to make that stick until we figure something longer term out?
Yeah, a lot of tools hardcode the source.js
scope. Or source.ts
in at least one case I vaguely recall. Tools should really make this configurable, in my opinion.
The configurations in the package settings were supposed to be examples to illustrate likely use cases, but I'm aware that they're also used out of the box. As I recall, I sort of tossed them together before the initial release, so there is probably room for improvement.
Anyway, if you just want the base scope to be source.jsx
, JS Custom provides a configuration option for that. If you specify "scope": "source.jsx"
, I think that should do what you want.
Can I set that in the configurations.React
Object? When I customize that object in user settings, are those deep merged with the defaults?
It's not deep-merged, no; if you want the example configurations plus changes, you'll have to copy the configurations
object and modify it.
I've set the react syntax to the jsx scope, and things are working great (though I did have to modify some scopes on other plugins to get them to activate in the new jsx scope.
Closing for now, reopen if you feel there is more to do here. Perhaps in the future this can be made to be the default.