From 5fdb3196a3f54541b10c6117af72ea6630cbb27b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 19 Dec 2013 17:08:18 -0800 Subject: [PATCH] Add cancelScan() --- src/project.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 6357ee449..86e1393d3 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -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