forked from Unity-Technologies/vscode-unity-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattach.js
More file actions
62 lines (49 loc) · 1.68 KB
/
attach.js
File metadata and controls
62 lines (49 loc) · 1.68 KB
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
var vscode = require('vscode');
var exec = require('child_process').exec;
function activate(context) {
var disposable = vscode.commands.registerCommand('attach.attachToDebugger', function () {
var execCommand = "";
if(process.platform !== 'win32')
execCommand = "mono ";
exec(execCommand + context.extensionPath + "/bin/UnityDebug.exe list", function(error, stdout, stderr) {
var processes = [];
var lines = stdout.split("\n");
for(var i = 0; i < lines.length; i++)
{
if(lines[i])
{
processes.push(lines[i]);
}
}
if(processes.length == 0)
{
vscode.window.showErrorMessage("No Unity Process Found.");
}else{
vscode.window.showQuickPick(processes)
.then(function(string){
if(!string)
{
return;
}
var config = {
name:string,
type:"unity",
request:"launch"
};
var call = vscode.commands.executeCommand("vscode.startDebug", config);
call.then(function(response){
console.log(response);
},function(error)
{
console.log(error);
});
});
}
});
});
context.subscriptions.push(disposable);
}
exports.activate = activate;
function deactivate() {
}
exports.deactivate = deactivate;