Skip to content

Commit 51fff8e

Browse files
authored
Add new "console" launch config for cppvsdbg (#6794)
* Add new "console" launch config for vsdbg This PR adds new console support for the cppvsdbg debug type. This removes the legacy 'externalConsole' flag with 'console'. Console has four enums: - internalConsole: Output to the VS Code Debug Console. This doesn't support reading console input (ex:Console.ReadLine) - integratedTerminal: VS Code's integrated terminal - externalTerminal: External terminal that can be configured via user settings - newExternalWindow: Console applications will be launched in their own external console window which will end when the application stops. Non-console applications will run without a terminal, and stdout/stderr will be ignored.
1 parent e4809d9 commit 51fff8e

File tree

5 files changed

+53
-5
lines changed

5 files changed

+53
-5
lines changed

Extension/package.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,23 @@
19891989
"description": "%c_cpp.debuggers.cppvsdbg.externalConsole.description%",
19901990
"default": false
19911991
},
1992+
"console": {
1993+
"type": "string",
1994+
"enum": [
1995+
"internalConsole",
1996+
"integratedTerminal",
1997+
"externalTerminal",
1998+
"newExternalWindow"
1999+
],
2000+
"enumDescriptions": [
2001+
"%c_cpp.debuggers.cppvsdbg.console.internalConsole.description%",
2002+
"%c_cpp.debuggers.cppvsdbg.console.integratedTerminal.description%",
2003+
"%c_cpp.debuggers.cppvsdbg.console.externalTerminal.description%",
2004+
"%c_cpp.debuggers.cppvsdbg.console.newExternalWindow.description%"
2005+
],
2006+
"description": "%c_cpp.debuggers.cppvsdbg.console.description%",
2007+
"default": "externalTerminal"
2008+
},
19922009
"sourceFileMap": {
19932010
"type": "object",
19942011
"description": "%c_cpp.debuggers.sourceFileMap.description%",
@@ -2730,7 +2747,7 @@
27302747
},
27312748
{
27322749
"description": "Visual Studio Windows Debugger",
2733-
"url": "https://go.microsoft.com/fwlink/?linkid=2152353",
2750+
"url": "https://go.microsoft.com/fwlink/?linkid=2153010",
27342751
"platforms": [
27352752
"win32"
27362753
],
@@ -2741,7 +2758,7 @@
27412758
"binaries": [
27422759
"./debugAdapters/vsdbg/bin/vsdbg.exe"
27432760
],
2744-
"integrity": "8299A112D1260C2CEA53AC74D18FA73DE8533C058AAAB254571B503FBAC37297"
2761+
"integrity": "52C4234976D527A7BF02EB2E8844F3C605DC4BD1D3847F83C8675CD23967BAB3"
27452762
}
27462763
]
27472764
}

Extension/package.nls.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,12 @@
213213
"c_cpp.debuggers.serverLaunchTimeout.description": "Optional time, in milliseconds, for the debugger to wait for the debugServer to start up. Default is 10000.",
214214
"c_cpp.debuggers.coreDumpPath.description": "Optional full path to a core dump file for the specified program. Defaults to null.",
215215
"c_cpp.debuggers.cppdbg.externalConsole.description": "If true, a console is launched for the debuggee. If false, on Linux and Windows, it will appear in the Integrated Console.",
216-
"c_cpp.debuggers.cppvsdbg.externalConsole.description": "If true, a console is launched for the debuggee. If false, no console is launched.",
216+
"c_cpp.debuggers.cppvsdbg.externalConsole.description": "[Deprecated by 'console'] If true, a console is launched for the debuggee. If false, no console is launched.",
217+
"c_cpp.debuggers.cppvsdbg.console.description": "Where to launch the debug target. Defaults to 'internalConsole' if not defined.",
218+
"c_cpp.debuggers.cppvsdbg.console.internalConsole.description": "Output to the VS Code Debug Console. This doesn't support reading console input (ex:'std::cin' or 'scanf')",
219+
"c_cpp.debuggers.cppvsdbg.console.integratedTerminal.description": "VS Code's integrated terminal",
220+
"c_cpp.debuggers.cppvsdbg.console.externalTerminal.description": "Console applications will be launched in an external terminal window. The window will be reused in relaunch scenarios, and will not automatically disappear when the application exits.",
221+
"c_cpp.debuggers.cppvsdbg.console.newExternalWindow.description": "Console applications will be launched in their own external console window which will end when the application stops. Non-console applications will run without a terminal, and stdout/stderr will be ignored.",
217222
"c_cpp.debuggers.avoidWindowsConsoleRedirection.description": "If true, disables debuggee console redirection that is required for Integrated Terminal support.",
218223
"c_cpp.debuggers.sourceFileMap.description": "Optional source file mappings passed to the debug engine. Example: '{ \"/original/source/path\":\"/current/source/path\" }'",
219224
"c_cpp.debuggers.processId.anyOf.description": "Optional process id to attach the debugger to. Use \"${command:pickProcess}\" to get a list of local running processes to attach to. Note that some platforms require administrator privileges in order to attach to a process.",

Extension/src/Debugger/configurationProvider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
182182

183183
newConfig.name = compilerName + buildAndDebugActiveFileStr();
184184
newConfig.preLaunchTask = task.name;
185-
newConfig.externalConsole = false;
185+
newConfig.console = "externalTerminal";
186186
const exeName: string = path.join("${fileDirname}", "${fileBasenameNoExtension}");
187187
const isWindows: boolean = platform === 'win32';
188188
newConfig.program = isWindows ? exeName + ".exe" : exeName;
@@ -246,6 +246,15 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
246246
}
247247

248248
if (config.type === 'cppvsdbg') {
249+
// Handle legacy 'externalConsole' bool and convert to console: "externalTerminal"
250+
if (config.hasOwnProperty("externalConsole")) {
251+
logger.getOutputChannelLogger().showWarningMessage(localize("debugger.deprecated.config", "The key '{0}' is deprecated. Please use '{1}' instead.", "externalConsole", "console"));
252+
if (config.externalConsole && !config.console) {
253+
config.console = "externalTerminal";
254+
}
255+
delete config.externalConsole;
256+
}
257+
249258
// Fail if cppvsdbg type is running on non-Windows
250259
if (os.platform() !== 'win32') {
251260
logger.getOutputChannelLogger().showWarningMessage(localize("debugger.not.available", "Debugger of type: '{0}' is only available on Windows. Use type: '{1}' on the current OS platform.", "cppvsdbg", "cppdbg"));

Extension/src/Debugger/configurations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function createLaunchString(name: string, type: string, executable: string): str
4444
"stopAtEntry": false,
4545
"cwd": "$\{workspaceFolder\}",
4646
"environment": [],
47-
"externalConsole": false
47+
"console": "externalTerminal"
4848
`;
4949
}
5050

Extension/tools/OptionsSchema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,23 @@
546546
"description": "%c_cpp.debuggers.cppvsdbg.externalConsole.description%",
547547
"default": false
548548
},
549+
"console": {
550+
"type": "string",
551+
"enum": [
552+
"internalConsole",
553+
"integratedTerminal",
554+
"externalTerminal",
555+
"newExternalWindow"
556+
],
557+
"enumDescriptions": [
558+
"%c_cpp.debuggers.cppvsdbg.console.internalConsole.description%",
559+
"%c_cpp.debuggers.cppvsdbg.console.integratedTerminal.description%",
560+
"%c_cpp.debuggers.cppvsdbg.console.externalTerminal.description%",
561+
"%c_cpp.debuggers.cppvsdbg.console.newExternalWindow.description%"
562+
],
563+
"description": "%c_cpp.debuggers.cppvsdbg.console.description%",
564+
"default": "internalConsole"
565+
},
549566
"sourceFileMap": {
550567
"type": "object",
551568
"description": "%c_cpp.debuggers.sourceFileMap.description%",

0 commit comments

Comments
 (0)