Add cancelScan()

This commit is contained in:
Ben Ogle
2013-12-19 17:08:18 -08:00
parent 8763a49dc6
commit 5fdb3196a3

View File

@@ -275,8 +275,7 @@ class Project extends Model
excludeVcsIgnores: atom.config.get('core.excludeVcsIgnoredPaths')
exclusions: atom.config.get('core.ignoredNames')
if @scanTask?
@scanTask.terminate()
@cancelScan()
@scanTask = Task.once require.resolve('./scan-handler'), @getPath(), regex.source, searchOptions, =>
@scanTask = null
@@ -297,6 +296,12 @@ class Project extends Model
deferred.promise
# Public: Cancels the current scan task if there is one running.
cancelScan: ->
if @scanTask?
@scanTask.terminate()
@scanTask = null
# Public: Performs a replace across all the specified files in the project.
#
# * regex: A RegExp to search with