Skip to content

Commit cb578c3

Browse files
karthiknadigDonJayamanne
authored andcommitted
Ensure arguments are generated correctly for getRemoteLauncherCommand when in debugger experiment (#8712)
* Return new debugger arguments when in experiment * Add news item
1 parent 43f35b3 commit cb578c3

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

news/2 Fixes/8685.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure arguments are generated correctly for `getRemoteLauncherCommand` when in debugger experiment.

src/client/debugger/extension/adapter/factory.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { inject, injectable } from 'inversify';
77
import * as path from 'path';
88
import { DebugAdapterDescriptor, DebugAdapterExecutable, DebugAdapterServer, DebugSession, WorkspaceFolder } from 'vscode';
99
import { IApplicationShell } from '../../../common/application/types';
10-
import { DebugAdapterNewPtvsd } from '../../../common/experimentGroups';
10+
import { DebugAdapterDescriptorFactory as DebugAdapterExperiment, DebugAdapterNewPtvsd } from '../../../common/experimentGroups';
1111
import { traceVerbose } from '../../../common/logger';
1212
import { IExperimentsManager } from '../../../common/types';
1313
import { EXTENSION_ROOT_DIR } from '../../../constants';
@@ -26,7 +26,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
2626
@inject(IInterpreterService) private readonly interpreterService: IInterpreterService,
2727
@inject(IApplicationShell) private readonly appShell: IApplicationShell,
2828
@inject(IExperimentsManager) private readonly experimentsManager: IExperimentsManager
29-
) {}
29+
) { }
3030
public async createDebugAdapterDescriptor(session: DebugSession, executable: DebugAdapterExecutable | undefined): Promise<DebugAdapterDescriptor> {
3131
const configuration = session.configuration as (LaunchRequestArguments | AttachRequestArguments);
3232

@@ -86,6 +86,9 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
8686

8787
public getRemotePtvsdArgs(remoteDebugOptions: RemoteDebugOptions): string[] {
8888
const waitArgs = remoteDebugOptions.waitUntilDebuggerAttaches ? ['--wait'] : [];
89+
if (this.experimentsManager.inExperiment(DebugAdapterExperiment.experiment) && this.experimentsManager.inExperiment(DebugAdapterNewPtvsd.experiment)) {
90+
return ['--host', remoteDebugOptions.host, '--port', remoteDebugOptions.port.toString(), ...waitArgs];
91+
}
8992
return ['--default', '--host', remoteDebugOptions.host, '--port', remoteDebugOptions.port.toString(), ...waitArgs];
9093
}
9194

src/test/extension.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ suite('Extension API Debugger', () => {
5959

6060
test('Test debug launcher args (no-wait and in experiment)', async () => {
6161
mockInExperiment();
62-
when(debugAdapterFactory.getRemotePtvsdArgs(anything())).thenReturn(['--default', '--host', 'something', '--port', '1234']);
62+
when(debugAdapterFactory.getRemotePtvsdArgs(anything())).thenReturn(['--host', 'something', '--port', '1234']);
6363

6464
const args = await buildApi(Promise.resolve(), instance(experimentsManager), instance(debugAdapterFactory), instance(configurationService)).debug.getRemoteLauncherCommand(
6565
'something',
6666
1234,
6767
false
6868
);
69-
const expectedArgs = [ptvsdPath, '--default', '--host', 'something', '--port', '1234'];
69+
const expectedArgs = [ptvsdPath, '--host', 'something', '--port', '1234'];
7070

7171
expect(args).to.be.deep.equal(expectedArgs);
7272
});
@@ -86,14 +86,14 @@ suite('Extension API Debugger', () => {
8686

8787
test('Test debug launcher args (wait and in experiment)', async () => {
8888
mockInExperiment();
89-
when(debugAdapterFactory.getRemotePtvsdArgs(anything())).thenReturn(['--default', '--host', 'something', '--port', '1234', '--wait']);
89+
when(debugAdapterFactory.getRemotePtvsdArgs(anything())).thenReturn(['--host', 'something', '--port', '1234', '--wait']);
9090

9191
const args = await buildApi(Promise.resolve(), instance(experimentsManager), instance(debugAdapterFactory), instance(configurationService)).debug.getRemoteLauncherCommand(
9292
'something',
9393
1234,
9494
true
9595
);
96-
const expectedArgs = [ptvsdPath, '--default', '--host', 'something', '--port', '1234', '--wait'];
96+
const expectedArgs = [ptvsdPath, '--host', 'something', '--port', '1234', '--wait'];
9797

9898
expect(args).to.be.deep.equal(expectedArgs);
9999
});

0 commit comments

Comments
 (0)