Skip to content

Commit b83dd74

Browse files
author
Jakob Werner
committed
1.2.0 - prefiltering large workspace
1 parent 3945fd5 commit b83dd74

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## 1.2.0
2+
3+
* Now pre-filtering when a workspace has more than 1000 files.
4+
5+
## 1.1.0
6+
7+
* Multi-workspace support.
8+
9+
## 1.0.0.
10+
11+
* First stable release.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Relative path support for Visual Studio Code
22
Now you can get the relative path to any file in the workspace.
33

4-
Just press `Ctrl+Shift+H` (Mac: `Cmd+Shift+H`) and select a file.
4+
Just press `Ctrl+Shift+H` (Mac: `Cmd+Shift+H`) and select a file. If your workspace has more than 1000 files, you will be prompted to filter that list first.
55
Alternatively, you can press open command palette `F1` and search for `Relative Path`.
66

77
![GIF](https://media.giphy.com/media/3oEduJ5iRksPxpwoXC/giphy.gif)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "RelativePath",
33
"description": "Get relative url paths from files in the current workspace.",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/jakob101/RelativePath"

src/extension.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class RelativePath {
177177
});
178178

179179
let pickResult: Thenable<QuickPickItem>;
180-
pickResult = window.showQuickPick(paths, { matchOnDescription: true, placeHolder: "Filename" });
180+
pickResult = window.showQuickPick(paths, { matchOnDescription: true, placeHolder: `Type to filter ${items.length} files` });
181181
pickResult.then((item: QuickPickItem) => this.returnRelativeLink(item, editor));
182182
} else {
183183
window.showInformationMessage("No files to show.");
@@ -242,7 +242,29 @@ class RelativePath {
242242
return;
243243
}
244244

245-
this.showQuickPick(this._items, editor);
245+
// Don't filter on too many files. Show the input search box instead
246+
if (this._items.length > 1000) {
247+
const placeHolder = `Found ${this._items.length} files. Enter the filter query. Consider adding more 'relativePath.ignore' settings.`;
248+
const input = window.showInputBox({placeHolder});
249+
input.then(val => {
250+
if (val === undefined) {
251+
// User pressed 'Escape'
252+
return;
253+
}
254+
255+
if (val === "") {
256+
// User just pressed 'Enter'
257+
this.showQuickPick(this._items, editor);
258+
return;
259+
}
260+
261+
this.showQuickPick(this._items.filter(item => item.toLowerCase().indexOf(val.toLowerCase()) > -1), editor);
262+
}, reason => {
263+
return;
264+
})
265+
} else {
266+
this.showQuickPick(this._items, editor);
267+
}
246268
}
247269

248270
dispose() {

0 commit comments

Comments
 (0)