mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Enable file extension .json for grammar files
This commit is contained in:
@@ -44,7 +44,7 @@ class DirectoryPackage
|
|||||||
path.split('/')[-2] == 'Syntaxes'
|
path.split('/')[-2] == 'Syntaxes'
|
||||||
when '.tmlanguage'
|
when '.tmlanguage'
|
||||||
true
|
true
|
||||||
when '.cson'
|
when '.cson', '.json'
|
||||||
path.split('/')[-2] == 'grammars'
|
path.split('/')[-2] == 'grammars'
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
@@ -148,7 +148,7 @@ def load_grammar(path)
|
|||||||
case File.extname(path.downcase)
|
case File.extname(path.downcase)
|
||||||
when '.plist', '.tmlanguage'
|
when '.plist', '.tmlanguage'
|
||||||
Plist::parse_xml(path)
|
Plist::parse_xml(path)
|
||||||
when '.cson'
|
when '.cson', '.json'
|
||||||
cson = `"#{CSONC}" "#{path}"`
|
cson = `"#{CSONC}" "#{path}"`
|
||||||
raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success?
|
raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success?
|
||||||
JSON.parse(cson)
|
JSON.parse(cson)
|
||||||
|
|||||||
Reference in New Issue
Block a user