Return paths instead of deferred from project.getFilePaths

It was already being performed synchronously
This commit is contained in:
Kevin Sawicki
2012-10-12 14:45:12 -07:00
parent 38802ba287
commit 19aa192c47
4 changed files with 11 additions and 13 deletions

View File

@@ -114,9 +114,9 @@ describe "Project", ->
spyOn(project, 'ignoreDirectory').andCallFake (path) -> fs.base(path).match /a$/
spyOn(project, 'ignoreFile').andCallFake (path) -> fs.base(path).match /a$/
project.getFilePaths().done (paths) ->
expect(paths).not.toContain('a')
expect(paths).toContain('b')
paths = project.getFilePaths()
expect(paths).not.toContain('a')
expect(paths).toContain('b')
describe ".scan(options, callback)", ->
describe "when called with a regex", ->

View File

@@ -40,11 +40,11 @@ describe 'FuzzyFinder', ->
it "shows all relative file paths for the current project and selects the first", ->
finder.maxResults = 1000
rootView.trigger 'fuzzy-finder:toggle-file-finder'
rootView.project.getFilePaths().done (paths) ->
expect(finder.pathList.children('li').length).toBe paths.length, finder.maxResults
for path in paths
expect(finder.pathList.find("li:contains(#{path})")).toExist()
expect(finder.pathList.children().first()).toHaveClass 'selected'
paths = rootView.project.getFilePaths()
expect(finder.pathList.children('li').length).toBe paths.length, finder.maxResults
for path in paths
expect(finder.pathList.find("li:contains(#{path})")).toExist()
expect(finder.pathList.children().first()).toHaveClass 'selected'
describe "when root view's project has no path", ->
beforeEach ->

View File

@@ -51,8 +51,6 @@ class Project
@rootDirectory
getFilePaths: ->
deferred = $.Deferred()
filePaths = []
onFile = (path) =>
@@ -62,8 +60,7 @@ class Project
return not @ignoreDirectory(path)
fs.traverseTree @getPath(), onFile, onDirectory
deferred.resolve filePaths
deferred
filePaths
ignoreDirectory: (path) ->
lastSlash = path.lastIndexOf('/')

View File

@@ -52,7 +52,8 @@ class FuzzyFinder extends View
@attach() if @paths?.length
populateProjectPaths: ->
@rootView.project.getFilePaths().done (@paths) => @populatePathList()
@paths = @rootView.project.getFilePaths()
@populatePathList()
populateOpenBufferPaths: ->
@paths = @rootView.getOpenBufferPaths().map (path) =>