-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.js
85 lines (71 loc) · 2.25 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// const vscode = require('vscode');
// const path = require('path');
// let _activeTerminal = null;
// vscode.window.onDidCloseTerminal((terminal) => {
// if (terminal.name === 'pd') {
// if (!terminal.tckDisposed) {
// disposeTerminal();
// }
// }
// });
// function createTerminal() {
// _activeTerminal = vscode.window.createTerminal('pd');
// return _activeTerminal;
// }
// function disposeTerminal() {
// _activeTerminal.tckDisposed = true;
// _activeTerminal.dispose();
// _activeTerminal = null;
// }
// function getTerminal() {
// if (!_activeTerminal) {
// createTerminal();
// }
// return _activeTerminal;
// }
// // END TERMINAL
// function resolve(editor, command) {
// const scPath = vscode.workspace.getConfiguration().get('pd.sclangCmd');
// return command
// .replace(/\${file}/g, `${editor.document.fileName}`)
// .replace(/\${sclangCmd}/g, scPath)
// }
// function run(command) {
// const terminal = getTerminal();
// terminal.show(true);
// vscode.commands.executeCommand('workbench.action.terminal.scrollToBottom');
// terminal.sendText(command, true);
// }
// function warn(msg) {
// console.log('pd.execInTerminal: ', msg)
// }
// function handleInput(editor) {
// vscode.workspace.saveAll(false);
// let command = "${sclangCmd} ${file}";
// const cmd = resolve(
// editor,
// command
// )
// run(cmd);
// }
// function activate(context) {
// let execInTerminal = vscode.commands.registerCommand('pd.execInTerminal', () => {
// const editor = vscode.window.activeTextEditor
// if (!editor) {
// warn('no active editor');
// return;
// }
// handleInput(editor)
// });
// context.subscriptions.push(execInTerminal);
// let killTerminal = vscode.commands.registerCommand('pd.killTerminal', () => {
// if(_activeTerminal)
// disposeTerminal();
// });
// context.subscriptions.push(killTerminal);
// }
// exports.activate = activate;
// function deactivate() {
// disposeTerminal();
// }
// exports.deactivate = deactivate;