Don't reuse buffer paths as project paths

This commit is contained in:
Kevin Sawicki 2012-12-17 10:55:48 -08:00 committed by Corey Johnson & Nathan Sobo
parent 9dbf07d81e
commit 57e45883bb
2 changed files with 23 additions and 2 deletions

View File

@ -209,3 +209,22 @@ describe 'FuzzyFinder', ->
runs ->
expect(rootView.project.getFilePaths).not.toHaveBeenCalled()
it "doesn't cache buffer paths", ->
spyOn(rootView.project, "getFilePaths").andCallThrough()
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
waitsFor ->
finder.list.children('li').length > 0
runs ->
expect(rootView.project.getFilePaths).not.toHaveBeenCalled()
rootView.project.getFilePaths.reset()
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
rootView.trigger 'fuzzy-finder:toggle-file-finder'
waitsFor ->
finder.list.children('li').length > 0
runs ->
expect(rootView.project.getFilePaths).toHaveBeenCalled()

View File

@ -18,6 +18,7 @@ class FuzzyFinder extends SelectList
allowActiveEditorChange: null
maxItems: 10
projectPaths: null
initialize: (@rootView) ->
super
@ -53,11 +54,12 @@ class FuzzyFinder extends SelectList
@attach() if @paths?.length
populateProjectPaths: ->
if @array?.length > 0
@setArray(@array)
if @projectPaths?.length > 0
@setArray(@projectPaths)
else
@setLoading("Indexing...")
@rootView.project.getFilePaths().done (paths) =>
@projectPaths = paths
@setArray(paths)
populateOpenBufferPaths: ->