Skip to content

Commit a9f77d2

Browse files
author
Jakob Werner
authored
Merge pull request #11 from jakob101/update-version
Fix bug with glob not resuming search
2 parents 8c60f38 + ccf7650 commit a9f77d2

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"theme": "dark"
1313
},
1414
"engines": {
15-
"vscode": "^1.0.0"
15+
"vscode": "^0.10.x"
1616
},
1717
"categories": [
1818
"Other"
@@ -77,11 +77,12 @@
7777
],
7878
"scripts": {
7979
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
80-
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
80+
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
81+
"postinstall": "node ./node_modules/vscode/bin/install"
8182
},
8283
"devDependencies": {
8384
"typescript": "^1.6.2",
84-
"vscode": "0.10.x"
85+
"vscode": "^0.11.0"
8586
},
8687
"dependencies": {
8788
"@types/glob": "^5.0.29",

src/extension.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ class RelativePath {
3232
private _workspacePath: string;
3333
private _configuration: any;
3434
private _pausedSearch: boolean;
35+
private _myGlob: any;
3536

3637
constructor() {
3738
this._items = null;
38-
this._pausedSearch = false;
39+
this._pausedSearch = null;
40+
this._myGlob = null;
3941
this._workspacePath = workspace.rootPath.replace(/\\/g, "/");
4042
this._configuration = workspace.getConfiguration("relativePath");
4143

@@ -66,33 +68,36 @@ class RelativePath {
6668
// Go through workspace to cache files
6769
private searchWorkspace() {
6870
let emptyItem: QuickPickItem = { label: "", description: "No files found" };
69-
let myGlob = null;
7071

7172
// Show loading info box
7273
let info = window.showQuickPick([emptyItem], { matchOnDescription: false, placeHolder: "Finding files... Please wait. (Press escape to cancel)" });
7374
info.then(
7475
(value?: any) => {
75-
if (myGlob) {
76-
myGlob.pause();
76+
if (this._myGlob) {
77+
this._myGlob.pause();
78+
}
79+
if (this._pausedSearch === null) {
80+
this._pausedSearch = true;
7781
}
78-
this._pausedSearch = true;
7982
},
8083
(rejected?: any) => {
81-
if (myGlob) {
82-
myGlob.pause();
84+
if (this._myGlob) {
85+
this._myGlob.pause();
86+
}
87+
if (this._pausedSearch === null) {
88+
this._pausedSearch = true;
8389
}
84-
this._pausedSearch = true;
8590
}
8691
);
8792

8893
// Search for files
8994
if (this._pausedSearch) {
9095
this._pausedSearch = false;
91-
if (myGlob) {
92-
myGlob.resume();
96+
if (this._myGlob) {
97+
this._myGlob.resume();
9398
}
9499
} else {
95-
myGlob = new Glob(this._workspacePath + "/**/*.*",
100+
this._myGlob = new Glob(this._workspacePath + "/**/*.*",
96101
{ ignore: this._configuration.get("ignore") },
97102
(err, files) => {
98103
if (err) {
@@ -102,7 +107,7 @@ class RelativePath {
102107
this._items = files;
103108
this.findRelativePath();
104109
});
105-
myGlob.on("end", () => {
110+
this._myGlob.on("end", () => {
106111
this._pausedSearch = false;
107112
});
108113
}

0 commit comments

Comments
 (0)