Rules are now sorted by key 'scope' before inserted to json scheme file.
@@ -7,6 +7,7 @@ from copy import deepcopy
import sublime
import re
from . import util
+from collections import OrderedDict
MARK_COLOR_RE = (
@@ -319,7 +320,9 @@ class JsonScheme(Scheme):
cleaned_rules = self.remove_dyn_rules(old_rules)
theme["rules"].extend(cleaned_rules)
- theme["rules"].extend(self.dynamic_nodes.values())
+ dyn_rules = self.dynamic_nodes.values()
+ dyn_rules = sorted(dyn_rules, key=lambda k: k["scope"])
+ theme["rules"].extend(dyn_rules)
with open(new_scheme_path, "w") as f:
content = json.dumps(theme, indent=4, sort_keys=True)
@@ -368,6 +371,7 @@ class JsonScheme(Scheme):
return result_dict
+
def init_scheme(force_xml_scheme=False):
"""Returns either the modern json schme parser or old xml scheme parser. Depending on sublime version."""
if int(sublime.version()) >= 3149 and not force_xml_scheme:
