mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 16:08:24 +03:00
Support opening project outline view without open editor
This commit is contained in:
parent
57e45883bb
commit
af99bac30a
@ -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'
|
||||
|
@ -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) ->
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user