Skip to content

Commit 0f444a3

Browse files
ColChJakob Werner
authored andcommitted
Omit path parts by regex array (#28)
1 parent 2615c30 commit 0f444a3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
"type": "boolean",
7272
"default": true,
7373
"description": "Removes the leading ./ character when the path is pointing to a parent folder."
74+
},
75+
"relativePath.omitParts": {
76+
"type": "arary",
77+
"default": [
78+
"\\/index$"
79+
],
80+
"description": "Omit path parts by matched Regular Expressions"
7481
}
7582
}
7683
}

src/extension.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ class RelativePath {
211211
relativeUrl = relativeUrl.substring(2, relativeUrl.length);
212212
}
213213

214+
if (this._configuration.omitParts) {
215+
this._configuration.omitParts.forEach(omitRegexp => {
216+
relativeUrl = relativeUrl.replace(new RegExp(omitRegexp), '');
217+
});
218+
}
219+
214220
window.activeTextEditor.edit(
215221
(editBuilder: TextEditorEdit) => {
216222
let position: Position = window.activeTextEditor.selection.end;

0 commit comments

Comments
 (0)