mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Reload grammar with edit session path changes
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -505,6 +505,7 @@ class Editor extends View
|
||||
@showBufferConflictAlert(@activeEditSession)
|
||||
|
||||
@activeEditSession.on "path-changed.editor", =>
|
||||
@reloadGrammar()
|
||||
@trigger 'editor:path-changed'
|
||||
|
||||
@trigger 'editor:path-changed'
|
||||
|
||||
Reference in New Issue
Block a user