Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@
"default": false,
"description": "Whether to enable Sub Process debugging",
"type": "boolean"
},
"consoleName": {
"default": "Python Debug Console",
"description": "Display name of the debug console or terminal",
"type": "string"
}
}
},
Expand Down Expand Up @@ -336,10 +341,6 @@
"internalConsole"
]
},
"consoleTitle": {
"default": "Python Debug Console",
"description": "Display name of the debug console or terminal"
},
"cwd": {
"default": "${workspaceFolder}",
"description": "Absolute path to the working directory of the program being debugged. Default is the root directory of the file (leave empty).",
Expand Down Expand Up @@ -493,6 +494,11 @@
"default": "matplotlib",
"description": "The GUI event loop that's going to run. Possible values: \"matplotlib\", \"wx\", \"qt\", \"none\", or a custom function that'll be imported and run.",
"type": "string"
},
"consoleName": {
"default": "Python Debug Console",
"description": "Display name of the debug console or terminal",
"type": "string"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/extension/debugger/configuration/resolvers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
if (debugConfiguration.clientOS === undefined) {
debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix';
}
if (debugConfiguration.consoleName) {
debugConfiguration.consoleTitle = debugConfiguration.consoleName;
delete debugConfiguration.consoleName;
}
return debugConfiguration as T;
}

Expand Down
4 changes: 4 additions & 0 deletions src/extension/debugger/configuration/resolvers/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
if (debugConfiguration.clientOS === undefined) {
debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix';
}
if (debugConfiguration.consoleName) {
debugConfiguration.consoleTitle = debugConfiguration.consoleName;
delete debugConfiguration.consoleName;
}
return debugConfiguration;
}

Expand Down
20 changes: 20 additions & 0 deletions src/test/unittest/configuration/resolvers/attach.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,5 +565,25 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
expect(debugConfig).to.have.property('justMyCode', testParams.expectedResult);
});
});

test('Send consoleName value to debugpy as consoleTitle', async () => {
const activeFile = 'xyz.py';
const consoleName = 'My Console Name';
const workspaceFolder = createMoqWorkspaceFolder(__dirname);
setupActiveEditor(activeFile, PYTHON_LANGUAGE);
const defaultWorkspace = path.join('usr', 'desktop');
setupWorkspaces([defaultWorkspace]);

const debugOptions = debugOptionsAvailable
.slice()
.concat(DebugOptions.Jinja, DebugOptions.Sudo) as DebugOptions[];

const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
...attach,
debugOptions,
consoleName,
});
expect(debugConfig).to.have.property('consoleTitle', consoleName);
});
});
});
15 changes: 15 additions & 0 deletions src/test/unittest/configuration/resolvers/launch.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,21 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
});
});

test('Send consoleName value to debugpy as consoleTitle', async () => {
const consoleName = 'My Console Name';
const pythonPath = `PythonPath_${new Date().toString()}`;
const workspaceFolder = createMoqWorkspaceFolder(__dirname);
const pythonFile = 'xyz.py';
setupIoc(pythonPath);
setupActiveEditor(pythonFile, PYTHON_LANGUAGE);

const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
...launch,
...{ consoleName },
});
expect(debugConfig).to.have.property('consoleTitle', consoleName);
});

async function testSetting(
requestType: 'launch' | 'attach',
settings: Record<string, boolean>,
Expand Down