-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.js
35 lines (30 loc) · 924 Bytes
/
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
const vscode = require('vscode');
function activate(context) {
let disposable = vscode.commands.registerCommand(
'js-debug-proxy-requestor.getProxy',
async () => {
const session = vscode.debug.activeDebugSession;
if (!session) {
vscode.window.showErrorMessage('No active debug session');
return;
}
try {
const addr = await vscode.commands.executeCommand(
'extension.js-debug.requestCDPProxy',
session.id,
);
const formed = `ws://${addr.host}:${addr.port}${addr.path || ''}`;
vscode.env.clipboard.writeText(formed);
vscode.window.showInformationMessage(`Address copied to your clipboard (${formed})`);
} catch (e) {
vscode.window.showErrorMessage(e.message);
}
},
);
context.subscriptions.push(disposable);
}
function deactivate() {}
module.exports = {
activate,
deactivate,
};