blob: f386be0bed57de3a127f21bbcd9b9633fb3de576 (
plain)
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
|
import * as vscode from 'vscode';
import * as os from "os";
import { Config } from './config';
type DebugConfigProvider = (executable: string) => vscode.DebugConfiguration;
export function getDebugConfiguration(config: Config, program: string): any {
const knownEngines: Record<string, DebugConfigProvider> = {
"vadimcn.vscode-lldb": getLldbDebugConfig,
"ms-vscode.cpptools": getCppvsDebugConfig
};
var debugEngine = null;
if(config.debugEngine !== "") {
debugEngine = vscode.extensions.getExtension(config.debugEngine);
}
if(debugEngine === null || debugEngine === undefined) {
for (var engineId in knownEngines) {
debugEngine = vscode.extensions.getExtension(engineId);
if (debugEngine) {
break;
}
}
}
if (!debugEngine) {
vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)`
+ ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) extension for debugging.`);
return;
}
return knownEngines[debugEngine.id](program);
}
function getLldbDebugConfig(executable: string): vscode.DebugConfiguration {
return {
type: "lldb",
request: "launch",
name: "test debug",
program: executable,
cwd: vscode.workspace.workspaceFolders?.[0].uri.path
};
}
function getCppvsDebugConfig(executable: string): vscode.DebugConfiguration {
return {
type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg",
request: "launch",
name: "test debug",
program: executable,
cwd: vscode.workspace.workspaceFolders?.[0].uri.path
};
}
|