Only use the first line when determine the syntax via file contents

This commit is contained in:
Corey Johnson
2013-02-20 12:38:49 -08:00
parent 27f44fbfd7
commit e0212ba02b
2 changed files with 7 additions and 1 deletions

View File

@@ -43,7 +43,9 @@ class Syntax
catch e
null
_.find @grammars, (grammar) -> grammar.firstLineRegex?.test(fileContents)
if fileContents
firstLine = fileContents.match(/^.*$/m)
_.find @grammars, (grammar) -> grammar.firstLineRegex?.test(firstLine)
grammarForScopeName: (scopeName) ->
@grammarsByScopeName[scopeName]