Skip to content

Commit 1d9e88a

Browse files
authored
Always register the swift-lldb debug adapter provider (#886)
Issue: #848 We can always register this and that way the user does not need to reload the window when use change to using lldb-dap. Now they can use the updated debug configurations right away If the lldb-dap path doesn't exist or it is not in the toolchain, the debug session bales without doing anything, so we'll check if lldb-dap exists and show error message if it doesn't
1 parent 3556c7d commit 1d9e88a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/debugger/debugAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class DebugAdapter {
5858
: workspace.toolchain.getToolchainExecutable(debugAdapter);
5959
if (!(await this.doesFileExist(lldbDebugAdapterPath))) {
6060
if (!quiet) {
61-
vscode.window.showInformationMessage(
61+
vscode.window.showErrorMessage(
6262
useCustom
6363
? `Cannot find ${debugAdapter} debug adapter specified in setting Swift.Debugger.Path.`
6464
: `Cannot find ${debugAdapter} debug adapter in your Swift toolchain.`

src/debugger/debugAdapterFactory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export function registerLLDBDebugAdapter(workspaceContext: WorkspaceContext): vs
3030
configuration.debugger.debugAdapterPath.length > 0
3131
? configuration.debugger.debugAdapterPath
3232
: workspaceContext.toolchain.getToolchainExecutable(debugAdapter);
33+
DebugAdapter.verifyDebugAdapterExists(workspaceContext).then(() => {
34+
/** Ignore */
35+
});
3336
executable = new vscode.DebugAdapterExecutable(lldbDebugAdapterPath, [], {});
3437
}
3538

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api |
213213

214214
const testExplorerObserver = TestExplorer.observeFolders(workspaceContext);
215215

216-
if (configuration.debugger.useDebugAdapterFromToolchain) {
217-
const lldbDebugAdapter = registerLLDBDebugAdapter(workspaceContext);
218-
context.subscriptions.push(lldbDebugAdapter);
219-
}
216+
// Register swift-lldb debug provider
217+
const lldbDebugAdapter = registerLLDBDebugAdapter(workspaceContext);
218+
context.subscriptions.push(lldbDebugAdapter);
219+
220220
const loggingDebugAdapter = registerLoggingDebugAdapterTracker();
221221

222222
// setup workspace context with initial workspace folders

0 commit comments

Comments
 (0)