mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Favor non bundle packages when breaking ties
This commit is contained in:
@@ -35,7 +35,16 @@ class GrammarRegistry extends FirstMate.GrammarRegistry
|
||||
# * `fileContents` A {String} of text for the file path.
|
||||
#
|
||||
# Returns a {Grammar}, never null.
|
||||
selectGrammar: (filePath, fileContents) -> super
|
||||
selectGrammar: (filePath, fileContents) ->
|
||||
bestMatch = null
|
||||
highestScore = -Infinity
|
||||
for grammar in @grammars
|
||||
score = grammar.getScore(filePath, fileContents)
|
||||
if score > highestScore
|
||||
bestMatch = grammar
|
||||
else if score is highestScore
|
||||
bestMatch = grammar if bestMatch.bundledPackage and not grammar.bundledPackage
|
||||
bestMatch
|
||||
|
||||
clearObservers: ->
|
||||
@off() if includeDeprecatedAPIs
|
||||
|
||||
Reference in New Issue
Block a user