Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"theme": "dark"
},
"engines": {
"vscode": "^1.0.0"
"vscode": "^0.10.x"
},
"categories": [
"Other"
Expand Down Expand Up @@ -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",
Expand Down
29 changes: 17 additions & 12 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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) {
Expand All @@ -102,7 +107,7 @@ class RelativePath {
this._items = files;
this.findRelativePath();
});
myGlob.on("end", () => {
this._myGlob.on("end", () => {
this._pausedSearch = false;
});
}
Expand Down