mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Enable file extension .json for grammar files
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user