s/grammarName/grammar

This commit is contained in:
joshaber
2016-03-03 10:09:18 -05:00
parent 98c8a08ac3
commit 928205a44a
2 changed files with 5 additions and 5 deletions

View File

@@ -5840,14 +5840,14 @@ describe "TextEditor", ->
invisibles = editor.tokenizedLineForScreenRow(0).invisibles
expect(invisibles).toBe(null)
describe "when the editor is constructed with the grammarName option set", ->
describe "when the editor is constructed with the grammar option set", ->
beforeEach ->
atom.workspace.destroyActivePane()
waitsForPromise ->
atom.packages.activatePackage('language-coffee-script')
waitsForPromise ->
atom.workspace.open('sample.js', grammarName: 'source.coffee').then (o) -> editor = o
atom.workspace.open('sample.js', grammar: atom.grammars.grammarForScopeName('source.coffee')).then (o) -> editor = o
it "sets the grammar", ->
expect(editor.getGrammar().name).toBe 'CoffeeScript'

View File

@@ -100,7 +100,7 @@ class TextEditor extends Model
softWrapped, @displayBuffer, @selectionsMarkerLayer, buffer, suppressCursorCreation,
@mini, @placeholderText, lineNumberGutterVisible, largeFileMode, @config,
@notificationManager, @packageManager, @clipboard, @viewRegistry, @grammarRegistry,
@project, @assert, @applicationDelegate, grammarName, showInvisibles, @autoHeight, @scrollPastEnd
@project, @assert, @applicationDelegate, grammar, showInvisibles, @autoHeight, @scrollPastEnd
} = params
throw new Error("Must pass a config parameter when constructing TextEditors") unless @config?
@@ -156,8 +156,8 @@ class TextEditor extends Model
priority: 0
visible: lineNumberGutterVisible
if grammarName?
@setGrammar(@grammarRegistry.grammarForScopeName(grammarName))
if grammar?
@setGrammar(grammar)
serialize: ->
deserializer: 'TextEditor'