Log scopes to notification instead of console

Fixes #4969
This commit is contained in:
Lee Dohm
2015-01-09 16:33:48 -08:00
parent 495a45e723
commit acb19c1fe1
2 changed files with 14 additions and 1 deletions

View File

@@ -944,6 +944,15 @@ describe "TextEditor", ->
editor.undo()
expect(editor.getScrollTop()).toBe 0
describe '.logCursorScope()', ->
beforeEach ->
spyOn(atom.notifications, 'addInfo')
it 'opens a notification', ->
editor.logCursorScope()
expect(atom.notifications.addInfo).toHaveBeenCalled()
describe "selection", ->
selection = null

View File

@@ -2522,7 +2522,11 @@ class TextEditor extends Model
logCursorScope: ->
scopeDescriptor = @getLastCursor().getScopeDescriptor()
console.log scopeDescriptor.scopes, scopeDescriptor
list = scopeDescriptor.scopes.toString().split(',')
list = _.map list, (item) -> "* #{item}"
content = "Scopes at Cursor\n#{list.join('\n')}"
atom.notifications.addInfo(content, dismissable: true)
# {Delegates to: DisplayBuffer.tokenForBufferPosition}
tokenForBufferPosition: (bufferPosition) -> @displayBuffer.tokenForBufferPosition(bufferPosition)