-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
49 lines (37 loc) · 1.26 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
const vscode = require('vscode');
const symbolMap = require('./symbol-map');
const keyMap = require('./key-map');
var active = false;
var statusBarItem = null;
function insertSymbol(symbol) {
vscode.commands.executeCommand('type', {
text: symbol
});
}
function activate(context) {
function registerCommand(name, func) {
const disposable = vscode.commands.registerCommand(name, func);
context.subscriptions.push(disposable);
}
for (var commandName in symbolMap) {
const symbol = symbolMap[commandName]
registerCommand(commandName, function() {
if (active) {
insertSymbol(symbol)
}
});
}
statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
statusBarItem.text = 'cu: OFF'
statusBarItem.show()
context.subscriptions.push(statusBarItem)
registerCommand('church-slavonic-toggle', function () {
active = !active;
statusBarItem.text = active ? 'cu: ON' : 'cu: OFF'
vscode.commands.executeCommand('setContext', 'cu.active', active);
});
vscode.commands.executeCommand('setContext', 'cu.active', active);
}
exports.activate = activate;
function deactivate() { }
exports.deactivate = deactivate;