mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Merge remote-tracking branch 'origin/dev' into cefode
This commit is contained in:
commit
e36e3c0a78
@ -2033,6 +2033,19 @@ describe "EditSession", ->
|
||||
editSession.buffer.reload()
|
||||
expect(editSession.getCursorScreenPosition()).toEqual [0,1]
|
||||
|
||||
describe "when the 'grammars-loaded' event is triggered on the syntax global", ->
|
||||
it "reloads the edit session's grammar and re-tokenizes the buffer if it changes", ->
|
||||
editSession.destroy()
|
||||
grammarToReturn = syntax.grammarByFileTypeSuffix('txt')
|
||||
spyOn(syntax, 'grammarForFilePath').andCallFake -> grammarToReturn
|
||||
|
||||
editSession = project.buildEditSession('sample.js', autoIndent: false)
|
||||
expect(editSession.lineForScreenRow(0).tokens.length).toBe 1
|
||||
|
||||
grammarToReturn = syntax.grammarByFileTypeSuffix('js')
|
||||
syntax.trigger 'grammars-loaded'
|
||||
expect(editSession.lineForScreenRow(0).tokens.length).toBeGreaterThan 1
|
||||
|
||||
describe "auto-indent", ->
|
||||
describe "editor.autoIndent", ->
|
||||
it "auto-indents newlines if editor.autoIndent is true", ->
|
||||
|
@ -61,6 +61,8 @@ class EditSession
|
||||
@subscribe @displayBuffer, "changed", (e) =>
|
||||
@trigger 'screen-lines-changed', e
|
||||
|
||||
@subscribe syntax, 'grammars-loaded', => @reloadGrammar()
|
||||
|
||||
getViewClass: ->
|
||||
require 'editor'
|
||||
|
||||
@ -841,11 +843,10 @@ class EditSession
|
||||
getGrammar: -> @languageMode.grammar
|
||||
|
||||
reloadGrammar: ->
|
||||
grammarChanged = @languageMode.reloadGrammar()
|
||||
if grammarChanged
|
||||
if @languageMode.reloadGrammar()
|
||||
@unfoldAll()
|
||||
@displayBuffer.tokenizedBuffer.resetScreenLines()
|
||||
grammarChanged
|
||||
true
|
||||
|
||||
getDebugSnapshot: ->
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user