Skip to content

Commit bd252dd

Browse files
author
Jakob Werner
committed
Added settings
1 parent 49f3bcb commit bd252dd

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ Alternatively, you can press open command palette `F1` and search for `Relative
99
## How to use
1010
First, you will need to install Visual Studio Code 0.10. In the command palette (`Ctrl-Shift-P` or `Cmd-Shift-P`) select `Install Extension` and choose `RelativePath`.
1111

12+
## Important
13+
Your workspace may be really big, so please wait for the initial file list to be created. This will happen only once.
14+
15+
## Options
16+
The following Visual Studio Code setting is available for the RelativePath extension. It can be set in user preferences (`ctrl+,` or `cmd+,`) or workspace settings (.vscode/settings.json).
17+
18+
{
19+
"relativePath.ignore": ["**/node_modules/**","**/*.dll"]
20+
}
21+
1222
## Bugs
1323
Report them [here](https://github.com/jakob101/RelativePath).
1424

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"name": "RelativePath",
33
"description": "Get relative url paths from files in the current workspace.",
4-
"version": "0.0.1",
4+
"version": "0.7.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/jakob101/RelativePath"
88
},
99
"publisher": "jakob101",
10+
"galleryBanner": {
11+
"color": "#373277",
12+
"theme": "dark"
13+
},
1014
"engines": {
1115
"vscode": "^0.10.1"
1216
},
@@ -29,7 +33,18 @@
2933
"key": "ctrl+shift+h",
3034
"mac": "cmd+shift+h",
3135
"when": "editorTextFocus"
32-
}]
36+
}],
37+
"configuration": {
38+
"title": "RelativePath extension configuration",
39+
"type": "object",
40+
"properties": {
41+
"relativePath.ignore": {
42+
"type": "string[]",
43+
"default": ["**/node_modules/**","**/*.dll","**/obj/**","**/objd/**"],
44+
"description": "An array of glob keys to ignore when searching."
45+
}
46+
}
47+
}
3348
},
3449
"icon": "icon.png",
3550
"keywords": ["relative", "path", "url", "file"],

src/extension.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ export function activate(context: vscode.ExtensionContext) {
1212
// This line of code will only be executed once when your extension is activated
1313
console.log('The extension "RelativePath" is now active!');
1414
const workspacePath: string = vscode.workspace.rootPath.replace(/\\/g, "/");
15+
var configuration = vscode.workspace.getConfiguration("relativePath");
1516
var editor = vscode.window.activeTextEditor;
17+
let emptyItem: vscode.QuickPickItem = { label: "", description: "No files found" };
1618
let items: string[] = null;
1719
var myGlob = null;
1820
let paused: boolean = false;
1921

2022
function myActivate() {
2123

2224
// Show loading info box
23-
let info = vscode.window.showQuickPick([], { matchOnDescription: false, placeHolder: "Finding files... Please wait. (Press escape to cancel)" });
25+
let info = vscode.window.showQuickPick([emptyItem], { matchOnDescription: false, placeHolder: "Finding files... Please wait. (Press escape to cancel)" });
2426
info.then(
25-
(value?: string) => {
27+
(value?: any) => {
2628
myGlob.pause();
2729
paused = true;
2830
},
@@ -38,7 +40,7 @@ export function activate(context: vscode.ExtensionContext) {
3840
myGlob.resume();
3941
} else {
4042
myGlob = new Glob(workspacePath + "/**/*.*",
41-
{ ignore: ["**/node_modules/**","**/*.dll","**/obj/**","**/objd/**"] },
43+
{ ignore: configuration.get("ignore") },
4244
function(err, files) {
4345
if (err) {
4446
return;
@@ -47,6 +49,9 @@ export function activate(context: vscode.ExtensionContext) {
4749
items = files;
4850
vscode.commands.executeCommand('extension.relativePath');
4951
});
52+
myGlob.on("end", function() {
53+
paused = false;
54+
})
5055
}
5156
}
5257

0 commit comments

Comments
 (0)