Respect core.excludeVcsIgnoredPaths in fuzzy finder

This commit is contained in:
Kevin Sawicki
2013-05-06 18:05:23 -07:00
parent a96c354f4f
commit 96418f3640
3 changed files with 28 additions and 6 deletions

View File

@@ -11,8 +11,8 @@ class PathLoader
rootPath: null
ignoredNames: null
constructor: (@rootPath, @ignoredNames) ->
@repo = Git.open(@rootPath)
constructor: (@rootPath, ignoreVcsIgnores=false, @ignoredNames=[]) ->
@repo = Git.open(@rootPath, refreshOnWindowFocus: false) if ignoreVcsIgnores
@ignoredNames.sort()
isIgnored: (loadedPath) ->
@@ -23,7 +23,7 @@ class PathLoader
asyncCallDone: ->
if --@asyncCallsInProgress is 0
@repo?.release()
@repo?.destroy()
callTaskMethod('pathsLoaded', @paths)
callTaskMethod('pathLoadingComplete')
@@ -53,6 +53,6 @@ class PathLoader
@loadFolder(@rootPath)
module.exports =
loadPaths: (rootPath, ignoredNames) ->
pathLoader = new PathLoader(rootPath, ignoredNames)
loadPaths: (rootPath, ignoreVcsIgnores, ignoredNames) ->
pathLoader = new PathLoader(rootPath, ignoreVcsIgnores, ignoredNames)
pathLoader.load()

View File

@@ -9,7 +9,8 @@ class LoadPathsTask extends Task
@paths = []
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('core.ignoredNames') ? [])
@callWorkerMethod('loadPaths', project.getPath(), ignoredNames)
ignoreVcsIgnores = config.get('core.excludeVcsIgnoredPaths')
@callWorkerMethod('loadPaths', project.getPath(), ignoreVcsIgnores, ignoredNames)
pathsLoaded: (paths) ->
@paths.push(paths...)

View File

@@ -353,6 +353,27 @@ describe 'FuzzyFinder', ->
runs ->
expect(finderView.list.find("li:contains(tree-view.js)")).not.toExist()
describe "when core.excludeVcsIgnoredPaths is set to true", ->
ignoreFile = null
beforeEach ->
ignoreFile = fsUtils.join(project.getPath(), '.gitignore')
fsUtils.write(ignoreFile, 'sample.js')
config.set("core.excludeVcsIgnoredPaths", true)
afterEach ->
fsUtils.remove(ignoreFile) if fsUtils.exists(ignoreFile)
it "ignores paths that are git ignored", ->
rootView.trigger 'fuzzy-finder:toggle-file-finder'
finderView.maxItems = Infinity
waitsFor ->
finderView.list.children('li').length > 0
runs ->
expect(finderView.list.find("li:contains(sample.js)")).not.toExist()
describe "fuzzy find by content under cursor", ->
editor = null