Reload grammar with edit session path changes

This commit is contained in:
Kevin Sawicki
2013-01-08 17:12:08 -08:00
parent d9385888c8
commit 61600fcdf1
2 changed files with 7 additions and 1 deletions

View File

@@ -502,6 +502,11 @@ describe "Editor", ->
editor.getBuffer().saveAs("/tmp/atom-new.txt")
expect(eventHandler).toHaveBeenCalled()
it "loads the grammar for the new path", ->
expect(editor.getGrammar().name).toBe 'JavaScript'
editor.getBuffer().saveAs(path)
expect(editor.getGrammar().name).toBe 'Plain Text'
describe "font size", ->
it "sets the initial font size based on the value from config", ->
config.set("editor.fontSize", 20)
@@ -2091,7 +2096,7 @@ describe "Editor", ->
expect(editor.getEditSessions().length).toBe 0
describe ".reloadGrammar()", ->
path = []
[path] = []
beforeEach ->
path = "/tmp/grammar-change.txt"

View File

@@ -505,6 +505,7 @@ class Editor extends View
@showBufferConflictAlert(@activeEditSession)
@activeEditSession.on "path-changed.editor", =>
@reloadGrammar()
@trigger 'editor:path-changed'
@trigger 'editor:path-changed'