Skip to content

Commit

Permalink
debug: register providers only if the debugger extension is installed
Browse files Browse the repository at this point in the history
Providing debug configurations if the debugger extension has 2 problems:
  * The debug configuration is listed in a menu item named "undefined"
  * The launch configuration will not work because the debugger does not
    exists
  • Loading branch information
ylatuya committed Aug 8, 2024
1 parent 65bfd5b commit 5184bc5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,18 @@ export async function activate(ctx: vscode.ExtensionContext) {
explorer = new MesonProjectExplorer(ctx, sourceDir, buildDir);

let providers = [];
if (os.platform() === "win32") {
providers.push(new MesonDebugConfigurationProvider(DebuggerType.cppvsdbg, buildDir));
} else {
providers.push(new MesonDebugConfigurationProvider(DebuggerType.cppdbg, buildDir));
// Check if CodeLLDB extension is installed
if (vscode.extensions.getExtension("vadimcn.vscode-lldb")) {
providers.push(new MesonDebugConfigurationProvider(DebuggerType.lldb, buildDir));
}

if (vscode.extensions.getExtension("ms-vscode.cpptools")) {
if (os.platform() === "win32") {
providers.push(new MesonDebugConfigurationProvider(DebuggerType.cppvsdbg, buildDir));
} else {
providers.push(new MesonDebugConfigurationProvider(DebuggerType.cppdbg, buildDir));
}
}
providers.push(new MesonDebugConfigurationProvider(DebuggerType.lldb, buildDir));
providers.forEach((p) => {
ctx.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider(
Expand Down

0 comments on commit 5184bc5

Please sign in to comment.