Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

Support TypeScript scopes for comments and tag closing #99

Closed Thom1729 closed 4 years ago

Thom1729 commented 4 years ago

The core JavaScript syntax uses the top-level scope source.js, and various features (such as the toggle_comment command) rely on that. JS Custom syntaxes default to more detailed top-level scopes like source.js.myconfiguration, which should work just as well. However, if you use the scope option to specify a custom scope like source.ts (e.g. for compatibility with other tools), then toggle_comment won't work (see #98).

This PR patches this problem for the common case by:

This should work well for most people in most cases. However, it's not a perfect solution:

I'll probably merge this for now, but in the long run I'll be looking at alternatives. One option is dynamically generating tmPreferences files alongside the compiled syntaxes. If I go that route, it probably won't be before v3.0.