mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Return paths instead of deferred from project.getFilePaths
It was already being performed synchronously
This commit is contained in:
@@ -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", ->
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
@@ -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('/')
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user