-
Notifications
You must be signed in to change notification settings - Fork 1
/
extension.js
32 lines (29 loc) · 1.15 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const vscode = require('vscode');
const ncp = require("copy-paste");
const path = require("path");
function addCommand(context, command, matchCase, matchWholeWord) {
let searchFileName = vscode.commands.registerCommand(command, function (fileUri) {
if (fileUri != undefined) {
var name = path.basename(fileUri.fsPath);
ncp.copy(name, function() {
vscode.commands.executeCommand('workbench.action.findInFiles', {
query: name,
triggerSearch: true,
matchWholeWord: matchWholeWord,
isCaseSensitive: matchCase,
});
});
}
});
context.subscriptions.push(searchFileName);
}
function activate(context) {
addCommand(context, 'extension.searchFileName', false, false);
addCommand(context, 'extension.searchFileName.matchCase', true, false);
addCommand(context, 'extension.searchFileName.matchWholeWord', false, true);
addCommand(context, 'extension.searchFileName.matchCaseAndWholeWord', true, true);
}
exports.activate = activate;
function deactivate() {
}
exports.deactivate = deactivate;