Implement .setGrammar in terms of .setLanguageMode

This commit is contained in:
Max Brunsfeld
2017-11-22 16:27:29 -08:00
parent 59ed55e898
commit d1468fddd9

View File

@@ -3561,7 +3561,8 @@ class TextEditor {
//
// * `grammar` {Grammar}
setGrammar (grammar) {
atom.grammars.assignLanguageMode(this.getBuffer(), grammar.name)
const buffer = this.getBuffer()
buffer.setLanguageMode(atom.grammars.languageModeForGrammarAndBuffer(grammar, buffer))
}
// Experimental: Get a notification when async tokenization is completed.