Marks paths for reload on focus and config events

Show the last loaded paths and load the latest in the
background when the FuzzyFinder is opened after a config
or focus event has been fired.

Previously the paths were completely cleared and the indexing
message was displayed while the latest paths were loaded.
This commit is contained in:
Kevin Sawicki
2013-01-11 08:59:39 -08:00
parent 618d9f5748
commit 7939b52da0
2 changed files with 7 additions and 8 deletions

View File

@@ -243,11 +243,6 @@ describe 'FuzzyFinder', ->
$(window).trigger 'focus'
rootView.trigger 'fuzzy-finder:toggle-file-finder'
rootView.trigger 'fuzzy-finder:toggle-file-finder'
waitsFor ->
finder.list.children('li').length > 0
runs ->
expect(rootView.project.getFilePaths).toHaveBeenCalled()
describe "path ignoring", ->

View File

@@ -17,12 +17,13 @@ class FuzzyFinder extends SelectList
allowActiveEditorChange: null
maxItems: 10
projectPaths: null
reloadProjectPaths: true
initialize: (@rootView) ->
super
@subscribe $(window), 'focus', => @projectPaths = null
@observeConfig 'fuzzy-finder.ignoredNames', (ignoredNames) =>
@projectPaths = null
@subscribe $(window), 'focus', => @reloadProjectPaths = true
@observeConfig 'fuzzy-finder.ignoredNames', => @reloadProjectPaths = true
@miniEditor.command 'editor:split-left', =>
@splitOpenPath (editor, session) -> editor.splitLeft(session)
@@ -93,6 +94,8 @@ class FuzzyFinder extends SelectList
@setArray(@projectPaths)
else
@setLoading("Indexing...")
if @reloadProjectPaths
@rootView.project.getFilePaths().done (paths) =>
ignoredNames = config.get("fuzzyFinder.ignoredNames") or []
ignoredNames = ignoredNames.concat(config.get("core.ignoredNames") or [])
@@ -103,6 +106,7 @@ class FuzzyFinder extends SelectList
return false if _.contains(ignoredNames, segment)
return true
@reloadProjectPaths = false
@setArray(@projectPaths)
populateOpenBufferPaths: ->