Skip to content

Commit ad37a53

Browse files
committed
Revert "src/goDebugConfiguration: change remote/attach default to dlv-dap"
This reverts commit 60c8ec9. Reason for revert: Need to address path mapping issue: #3175 Change-Id: I9422ab3feaad91ae7f44de90bb3fa3ffbe353278 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/576635 kokoro-CI: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Commit-Queue: Suzy Mueller <[email protected]>
1 parent 40990c0 commit ad37a53

File tree

3 files changed

+20
-32
lines changed

3 files changed

+20
-32
lines changed

extension/src/goDebugConfiguration.ts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -183,36 +183,25 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
183183
}
184184
}
185185
// If neither launch.json nor settings.json gave us the debugAdapter value, we go with the default
186-
// from package.json (dlv-dap).
186+
// from package.json (dlv-dap) unless this is remote attach with a stable release.
187187
if (!debugConfiguration['debugAdapter']) {
188188
debugConfiguration['debugAdapter'] = defaultConfig.debugAdapter.default;
189-
if (
190-
debugConfiguration.request === 'attach' &&
191-
debugConfiguration['mode'] === 'remote' &&
192-
!extensionInfo.isPreview
193-
) {
189+
if (debugConfiguration['mode'] === 'remote' && !extensionInfo.isPreview) {
190+
debugConfiguration['debugAdapter'] = 'legacy';
191+
}
192+
}
193+
if (debugConfiguration['debugAdapter'] === 'dlv-dap') {
194+
if (debugConfiguration['mode'] === 'remote') {
195+
// This needs to use dlv at version 'v1.7.3-0.20211026171155-b48ceec161d5' or later,
196+
// but we have no way of detectng that with an external server ahead of time.
197+
// If an earlier version is used, the attach will fail with warning about versions.
198+
} else if (debugConfiguration['port']) {
194199
this.showWarning(
195-
'ignoreDefaultDebugAdapterChangeWarning',
196-
"We are using the 'dlv-dap' integration for remote debugging by default. Please comment on [issue 3096](https://github.com/golang/vscode-go/issues/3096) if this impacts your workflows."
200+
'ignorePortUsedInDlvDapWarning',
201+
"`port` with 'dlv-dap' debugAdapter connects to [an external `dlv dap` server](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#running-debugee-externally) to launch a program or attach to a process. Remove 'host' and 'port' from your launch.json if you have not launched a 'dlv dap' server."
197202
);
198203
}
199204
}
200-
if (debugConfiguration['debugAdapter'] === 'legacy') {
201-
this.showWarning(
202-
'ignoreLegacyDADeprecationWarning',
203-
'Legacy debug adapter is deprecated. Please comment on [issue 3096](https://github.com/golang/vscode-go/issues/3096) if this impacts your workflows.'
204-
);
205-
}
206-
if (
207-
debugConfiguration['debugAdapter'] === 'dlv-dap' &&
208-
debugConfiguration.request === 'launch' &&
209-
debugConfiguration['port']
210-
) {
211-
this.showWarning(
212-
'ignorePortUsedInDlvDapWarning',
213-
"`port` with 'dlv-dap' debugAdapter connects to [a `dlv dap` server](https://github.com/golang/vscode-go/wiki/debugging#run-debugee-externally) to launch a program or attach to a process. Remove 'host'/'port' from your launch.json configuration if you have not launched a 'dlv dap' server."
214-
);
215-
}
216205

217206
const debugAdapter = debugConfiguration['debugAdapter'] === 'dlv-dap' ? 'dlv-dap' : 'dlv';
218207

extension/test/integration/goDebug.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ const testAll = (ctx: Mocha.Context, isDlvDap: boolean, withConsole?: string) =>
4242
name: 'Attach',
4343
type: 'go',
4444
request: 'attach',
45-
mode: 'remote',
45+
mode: 'remote', // This implies debugAdapter = legacy.
4646
host: '127.0.0.1',
47-
port: 3456,
48-
debugAdapter: isDlvDap ? undefined : 'legacy'
47+
port: 3456
4948
};
5049

5150
let dc: DebugClient;

extension/test/integration/goDebugConfiguration.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ suite('Debug Configuration Default DebugAdapter', () => {
951951
assert.strictEqual(resolvedConfig['debugAdapter'], 'dlv-dap');
952952
});
953953

954-
test("default debugAdapter for remote mode should be 'dlv-dap'", async () => {
954+
test("default debugAdapter for remote mode should be 'legacy' when not in Preview mode", async () => {
955955
const config = {
956956
name: 'Attach',
957957
type: 'go',
@@ -961,24 +961,24 @@ suite('Debug Configuration Default DebugAdapter', () => {
961961
cwd: '/path'
962962
};
963963

964-
const want = 'dlv-dap';
964+
const want = extensionInfo.isPreview ? 'dlv-dap' : 'legacy';
965965
await debugConfigProvider.resolveDebugConfiguration(undefined, config);
966966
const resolvedConfig = config as any;
967967
assert.strictEqual(resolvedConfig['debugAdapter'], want);
968968
});
969969

970-
test('debugAdapter=legacy is allowed with remote mode', async () => {
970+
test('debugAdapter=dlv-dap is allowed with remote mode', async () => {
971971
const config = {
972972
name: 'Attach',
973973
type: 'go',
974974
request: 'attach',
975975
mode: 'remote',
976-
debugAdapter: 'legacy',
976+
debugAdapter: 'dlv-dap',
977977
program: '/path/to/main_test.go',
978978
cwd: '/path'
979979
};
980980

981-
const want = 'legacy'; // If requested, legacy is preserved.
981+
const want = 'dlv-dap'; // If requested, dlv-dap is preserved.
982982
await debugConfigProvider.resolveDebugConfiguration(undefined, config);
983983
const resolvedConfig = config as any;
984984
assert.strictEqual(resolvedConfig['debugAdapter'], want);

0 commit comments

Comments
 (0)