Enable file extension .json for grammar files

This commit is contained in:
Florian Schäfer
2015-01-02 14:23:46 +01:00
parent 952acc983d
commit 6843aa7cc8

View File

@@ -44,7 +44,7 @@ class DirectoryPackage
path.split('/')[-2] == 'Syntaxes'
when '.tmlanguage'
true
when '.cson'
when '.cson', '.json'
path.split('/')[-2] == 'grammars'
else
false
@@ -148,7 +148,7 @@ def load_grammar(path)
case File.extname(path.downcase)
when '.plist', '.tmlanguage'
Plist::parse_xml(path)
when '.cson'
when '.cson', '.json'
cson = `"#{CSONC}" "#{path}"`
raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success?
JSON.parse(cson)