Skip to content

Commit

Permalink
use LLDB DAP extension by default (swiftlang#1406)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewbastien authored Feb 25, 2025
1 parent 32cb840 commit 9314392
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/debugger/debugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class DebugAdapter {
*/
public static getLaunchConfigType(swiftVersion: Version): LaunchConfigType {
const lldbDapIsAvailable = swiftVersion.isGreaterThanOrEqual(new Version(6, 0, 0));
if (lldbDapIsAvailable && configuration.debugger.debugAdapter === "lldb-dap") {
if (lldbDapIsAvailable && configuration.debugger.debugAdapter !== "CodeLLDB") {
return LaunchConfigType.LLDB_DAP;
} else {
return LaunchConfigType.CODE_LLDB;
Expand Down
15 changes: 8 additions & 7 deletions test/unit-tests/debugger/debugAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,23 @@ suite("DebugAdapter Unit Test Suite", () => {
});

suite("getLaunchConfigType()", () => {
test("returns SWIFT_EXTENSION when Swift version >=6.0.0 and swift.debugger.debugAdapter is set to lldb-dap", () => {
test("returns LLDB_DAP when Swift version >=6.0.0 and swift.debugger.debugAdapter is set to lldb-dap", () => {
mockDebugConfig.debugAdapter = "lldb-dap";
expect(DebugAdapter.getLaunchConfigType(new Version(6, 0, 1))).to.equal(
LaunchConfigType.LLDB_DAP
);
});

test("returns CODE_LLDB when Swift version >=6.0.0 and swift.debugger.debugAdapter is set to auto or CodeLLDB", () => {
// Try with the setting set to auto
test("returns LLDB_DAP when Swift version >=6.0.0 and swift.debugger.debugAdapter is set to auto", () => {
mockDebugConfig.debugAdapter = "auto";
expect(DebugAdapter.getLaunchConfigType(new Version(5, 10, 0))).to.equal(
LaunchConfigType.CODE_LLDB
expect(DebugAdapter.getLaunchConfigType(new Version(6, 0, 1))).to.equal(
LaunchConfigType.LLDB_DAP
);
// Try with the setting set to CodeLLDB
});

test("returns CODE_LLDB when Swift version >=6.0.0 and swift.debugger.debugAdapter is set to CODE_LLDB", () => {
mockDebugConfig.debugAdapter = "CodeLLDB";
expect(DebugAdapter.getLaunchConfigType(new Version(5, 10, 0))).to.equal(
expect(DebugAdapter.getLaunchConfigType(new Version(6, 0, 1))).to.equal(
LaunchConfigType.CODE_LLDB
);
});
Expand Down

0 comments on commit 9314392

Please sign in to comment.