diff --git a/package.json b/package.json index 635c4f5..48945fe 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "theme": "dark" }, "engines": { - "vscode": "^1.0.0" + "vscode": "^0.10.x" }, "categories": [ "Other" @@ -77,11 +77,12 @@ ], "scripts": { "vscode:prepublish": "node ./node_modules/vscode/bin/compile", - "compile": "node ./node_modules/vscode/bin/compile -watch -p ./" + "compile": "node ./node_modules/vscode/bin/compile -watch -p ./", + "postinstall": "node ./node_modules/vscode/bin/install" }, "devDependencies": { "typescript": "^1.6.2", - "vscode": "0.10.x" + "vscode": "^0.11.0" }, "dependencies": { "@types/glob": "^5.0.29", diff --git a/src/extension.ts b/src/extension.ts index 93be9d1..a8a89ad 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,10 +32,12 @@ class RelativePath { private _workspacePath: string; private _configuration: any; private _pausedSearch: boolean; + private _myGlob: any; constructor() { this._items = null; - this._pausedSearch = false; + this._pausedSearch = null; + this._myGlob = null; this._workspacePath = workspace.rootPath.replace(/\\/g, "/"); this._configuration = workspace.getConfiguration("relativePath"); @@ -66,33 +68,36 @@ class RelativePath { // Go through workspace to cache files private searchWorkspace() { let emptyItem: QuickPickItem = { label: "", description: "No files found" }; - let myGlob = null; // Show loading info box let info = window.showQuickPick([emptyItem], { matchOnDescription: false, placeHolder: "Finding files... Please wait. (Press escape to cancel)" }); info.then( (value?: any) => { - if (myGlob) { - myGlob.pause(); + if (this._myGlob) { + this._myGlob.pause(); + } + if (this._pausedSearch === null) { + this._pausedSearch = true; } - this._pausedSearch = true; }, (rejected?: any) => { - if (myGlob) { - myGlob.pause(); + if (this._myGlob) { + this._myGlob.pause(); + } + if (this._pausedSearch === null) { + this._pausedSearch = true; } - this._pausedSearch = true; } ); // Search for files if (this._pausedSearch) { this._pausedSearch = false; - if (myGlob) { - myGlob.resume(); + if (this._myGlob) { + this._myGlob.resume(); } } else { - myGlob = new Glob(this._workspacePath + "/**/*.*", + this._myGlob = new Glob(this._workspacePath + "/**/*.*", { ignore: this._configuration.get("ignore") }, (err, files) => { if (err) { @@ -102,7 +107,7 @@ class RelativePath { this._items = files; this.findRelativePath(); }); - myGlob.on("end", () => { + this._myGlob.on("end", () => { this._pausedSearch = false; }); }