Match firstLineRegex against entire file

This commit is contained in:
Kevin Sawicki
2012-12-26 15:22:39 -08:00
parent 7cce042f03
commit 110ccc9b7a

View File

@@ -50,11 +50,11 @@ class TextMateBundle
@grammarByShebang: (filePath) ->
try
firstLine = fs.read(filePath).match(/.*/)[0]
fileContents = fs.read(filePath)
catch e
null
_.find @grammars, (grammar) -> grammar.firstLineRegex?.test(firstLine)
_.find @grammars, (grammar) -> grammar.firstLineRegex?.test(fileContents)
@grammarForScopeName: (scopeName) ->
@grammarsByScopeName[scopeName]