Support opening project outline view without open editor

This commit is contained in:
Kevin Sawicki 2012-12-17 11:09:34 -08:00 committed by Corey Johnson & Nathan Sobo
parent 57e45883bb
commit af99bac30a
3 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,6 @@
window.keymap.bindKeys '.editor'
'meta-j': 'outline-view:toggle-file-outline'
'meta-J': 'outline-view:toggle-project-outline'
'meta-.': 'outline-view:jump-to-declaration'
window.keymap.bindKeys 'body'
'meta-J': 'outline-view:toggle-project-outline'

View File

@ -68,7 +68,7 @@ class OutlineView extends SelectList
populateProjectOutline: ->
@setLoading("Loading symbols...")
TagReader.getAllTags(@rootView.getActiveEditor()).done (tags) =>
TagReader.getAllTags(@rootView.project).done (tags) =>
if tags.length > 0
@miniEditor.show()
@maxItems = 10
@ -85,7 +85,7 @@ class OutlineView extends SelectList
openTag: (tag) ->
position = tag.position
position = @getTagLine(tag) unless position
@rootView.openInExistingEditor(tag.file, true, true) if tag.file
@rootView.open(tag.file, {changeFocus: true, allowActiveEditorChange:true}) if tag.file
@moveToPosition(position) if position
moveToPosition: (position) ->

View File

@ -3,8 +3,7 @@ $ = require 'jquery'
module.exports =
getTagsFile: (editor) ->
project = editor.rootView().project
getTagsFile: (project) ->
tagsFile = project.resolve("tags") or project.resolve("TAGS")
return tagsFile if fs.isFile(tagsFile)
@ -12,14 +11,14 @@ find: (editor) ->
word = editor.getTextInRange(editor.getCursor().getCurrentWordBufferRange())
return [] unless word.length > 0
tagsFile = @getTagsFile(editor)
tagsFile = @getTagsFile(editor.rootView().project)
return [] unless tagsFile
$tags.find(tagsFile, word) or []
getAllTags: (editor, callback) ->
getAllTags: (project, callback) ->
deferred = $.Deferred()
tagsFile = @getTagsFile(editor)
tagsFile = @getTagsFile(project)
if tagsFile
$tags.getAllTagsAsync tagsFile, (tags) =>
deferred.resolve(tags)