-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathextension.js
56 lines (48 loc) · 1.4 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const {commands, window} = require("vscode");
const SeeingIsBelieving = require("./lib/seeing_is_believing");
function activate(context) {
const verifyRuby = function() {
const activeEditor = window.activeTextEditor;
if (!activeEditor) {
return;
}
return activeEditor.document.languageId === "ruby";
};
const disposableToggleMarks = commands.registerCommand(
"seeing-is-believing.toggle-marks",
function() {
if (!verifyRuby()) {
return new Promise((_, rej) =>
rej("Seeing is Believing can only process Ruby files")
);
}
return SeeingIsBelieving.toggleMarks();
}
);
const disposableRun = commands.registerCommand(
"seeing-is-believing.run",
function() {
if (!verifyRuby()) {
return new Promise((_, rej) =>
rej("Seeing is Believing can only process Ruby files")
);
}
return SeeingIsBelieving.run();
}
);
const disposableClean = commands.registerCommand(
"seeing-is-believing.clean",
function() {
if (!verifyRuby()) {
return new Promise((_, rej) =>
rej("Seeing is Believing can only process Ruby files")
);
}
return SeeingIsBelieving.clean();
}
);
context.subscriptions.push(disposableToggleMarks);
context.subscriptions.push(disposableRun);
context.subscriptions.push(disposableClean);
}
exports.activate = activate;