diff --git a/spec/app/syntax-spec.coffee b/spec/app/syntax-spec.coffee index 943868fc4..6f5ece9df 100644 --- a/spec/app/syntax-spec.coffee +++ b/spec/app/syntax-spec.coffee @@ -23,8 +23,8 @@ describe "the `syntax` global", -> expect(syntax.selectGrammar("file.js").name).toBe "JavaScript" # based on extension (.js) expect(syntax.selectGrammar("/tmp/.git/config").name).toBe "Git Config" # based on end of the path (.git/config) expect(syntax.selectGrammar("Rakefile").name).toBe "Ruby" # based on the file's basename (Rakefile) - expect(syntax.selectGrammar("curb").name).toBe "Plain Text" - expect(syntax.selectGrammar("/hu.git/config").name).toBe "Plain Text" + expect(syntax.selectGrammar("curb").name).toBe "Null Grammar" + expect(syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar" it "uses the filePath's shebang line if the grammar cannot be determined by the extension or basename", -> filePath = require.resolve("fixtures/shebang") @@ -37,7 +37,7 @@ describe "the `syntax` global", -> expect(syntax.selectGrammar("dummy.coffee", fileContent).name).toBe "CoffeeScript" fileContent = '' - expect(syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Plain Text" + expect(syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Null Grammar" fileContent += '\n' expect(syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)" diff --git a/src/app/text-mate-grammar.coffee b/src/app/text-mate-grammar.coffee index a9f5090b6..95d52db1c 100644 --- a/src/app/text-mate-grammar.coffee +++ b/src/app/text-mate-grammar.coffee @@ -43,12 +43,10 @@ class TextMateGrammar contents = fsUtils.read(path) if not contents? and fsUtils.isFile(path) if syntax.grammarOverrideForPath(path) is @scopeName - Infinity - else if @matchesContents(contents) 3 - else if @matchesPath(path) + else if @matchesContents(contents) 2 - else if @isTextGrammar() + else if @matchesPath(path) 1 else -1 @@ -78,9 +76,6 @@ class TextMateGrammar pathSuffix = pathComponents[-fileTypeComponents.length..-1] _.isEqual(pathSuffix, fileTypeComponents) - isTextGrammar: -> - @scopeName is 'text.plain' - tokenizeLine: (line, ruleStack=[@initialRule], firstLine=false) -> originalRuleStack = ruleStack ruleStack = new Array(ruleStack...) # clone ruleStack