I’d imagine there is nothing surprising about this because the average user simply doesn’t open the syntax definition of their current file and edit scopes away. You shouldn’t generally be doing this unless you really know what you are doing.
I am not aware of any packages that does this off the top of my head, but if you have the OverrideAudit
package installed, it’s very easy to create a wrapper command around the override_audit_create_override
command. So all one has to do is give it the necessary information about the package (that the syntax belongs to) and it’s path and that command creates the override for you.
Note: This will work only in ST4 since it uses the new syntax API.
import sublime
import sublime_plugin
class OpenSyntaxAndEditCommand(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
syntax_path = view.syntax().path
package_name = syntax_path.split("/", maxsplit=2)[1]
file_name = syntax_path.split("/", maxsplit=2)[2]
self.window.run_command("override_audit_create_override", {
"package": package_name,
"file": file_name
})
You can then have this command in the command palette.
[
{ "caption": "Edit current syntax", "command": "open_syntax_and_edit", },
]
Note that since you are creating an override of a package resource, ST will continue to use that forever even after the said package receives updates. But OverrideAudit
should be able to tell you when the overrides have expired.