diff --git a/Extension/package.json b/Extension/package.json index 82af023f3..9aa887917 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -4859,6 +4859,10 @@ ] }, "default": [] + }, + "ignoreRunWithoutDebuggingWarnings": { + "description": "%c_cpp.debuggers.ignoreRunWithoutDebuggingWarnings.description%", + "default": false } } }, @@ -5895,6 +5899,10 @@ } } } + }, + "ignoreRunWithoutDebuggingWarnings": { + "description": "%c_cpp.debuggers.ignoreRunWithoutDebuggingWarnings.description%", + "default": false } } }, diff --git a/Extension/package.nls.json b/Extension/package.nls.json index f108f9d7d..994a1745c 100644 --- a/Extension/package.nls.json +++ b/Extension/package.nls.json @@ -1026,6 +1026,7 @@ "c_cpp.debuggers.VSSymbolOptionsModuleFilter.excludedModules.description": "Array of modules that the debugger should NOT load symbols for. Wildcards (example: MyCompany.*.dll) are supported.\n\nThis property is ignored unless 'mode' is set to 'loadAllButExcluded'.", "c_cpp.debuggers.VSSymbolOptionsModuleFilter.includedModules.description": "Array of modules that the debugger should load symbols for. Wildcards (example: MyCompany.*.dll) are supported.\n\nThis property is ignored unless 'mode' is set to 'loadOnlyIncluded'.", "c_cpp.debuggers.VSSymbolOptionsModuleFilter.includeSymbolsNextToModules.description": "If true, for any module NOT in the 'includedModules' array, the debugger will still check next to the module itself and the launching executable, but it will not check paths on the symbol search list. This option defaults to 'true'.\n\nThis property is ignored unless 'mode' is set to 'loadOnlyIncluded'.", + "c_cpp.debuggers.ignoreRunWithoutDebuggingWarnings.description": "If true, no warning will be logged when run without debugging fails to launch the program in the terminal.", "c_cpp.semanticTokenTypes.referenceType.description": "Style for C++/CLI reference types.", "c_cpp.semanticTokenTypes.cliProperty.description": "Style for C++/CLI properties.", "c_cpp.semanticTokenTypes.genericType.description": "Style for C++/CLI generic types.", diff --git a/Extension/src/Debugger/debugAdapterDescriptorFactory.ts b/Extension/src/Debugger/debugAdapterDescriptorFactory.ts index c20c12719..646251e94 100644 --- a/Extension/src/Debugger/debugAdapterDescriptorFactory.ts +++ b/Extension/src/Debugger/debugAdapterDescriptorFactory.ts @@ -86,21 +86,32 @@ function noDebugSupported(configuration: vscode.DebugConfiguration): boolean { } function logReasonForNoDebugNotSupported(configuration: vscode.DebugConfiguration): void { + if (configuration.ignoreRunWithoutDebuggingWarnings === true) { + return; + } + + const disallowedProperties = []; const outputChannel = getOutputChannel(); + outputChannel.show(true); + if (configuration.request !== 'launch') { outputChannel.appendLine(localize("debugger.noDebug.requestType.not.supported", "Run Without Debugging is only supported for launch configurations.")); + return; } if (configuration.pipeTransport) { - outputChannel.appendLine(localize("debugger.noDebug.pipeTransport.not.supported", "Run Without Debugging is not supported for configurations with 'pipeTransport' set.")); + disallowedProperties.push('pipeTransport'); } if (configuration.debugServerPath) { - outputChannel.appendLine(localize("debugger.noDebug.debugServerPath.not.supported", "Run Without Debugging is not supported for configurations with 'debugServerPath' set.")); + disallowedProperties.push('debugServerPath'); } if (configuration.miDebuggerServerAddress) { - outputChannel.appendLine(localize("debugger.noDebug.miDebuggerServerAddress.not.supported", "Run Without Debugging is not supported for configurations with 'miDebuggerServerAddress' set.")); + disallowedProperties.push('miDebuggerServerAddress'); } if (configuration.coreDumpPath) { - outputChannel.appendLine(localize("debugger.noDebug.coreDumpPath.not.supported", "Run Without Debugging is not supported for configurations with 'coreDumpPath' set.")); + disallowedProperties.push('coreDumpPath'); } - outputChannel.show(true); + outputChannel.appendLine(localize("debugger.unsupported.properties", "Launch configurations with the following properties cannot be run directly in the terminal: {0}", disallowedProperties.join(', '))); + outputChannel.appendLine(localize("debugger.fallback.message", "Program output will appear in the Debug Console instead.")); + outputChannel.appendLine(localize("debugger.fallback.message2", "To suppress this warning, set the 'ignoreRunWithoutDebuggingWarnings' property to true in your launch configuration.")); } + diff --git a/Extension/tools/OptionsSchema.json b/Extension/tools/OptionsSchema.json index 96e5c8e27..76f3f81dc 100644 --- a/Extension/tools/OptionsSchema.json +++ b/Extension/tools/OptionsSchema.json @@ -847,6 +847,10 @@ }, "deploySteps": { "$ref": "#/definitions/DeploySteps" + }, + "ignoreRunWithoutDebuggingWarnings": { + "description": "%c_cpp.debuggers.ignoreRunWithoutDebuggingWarnings.description%", + "default": false } } }, @@ -1118,6 +1122,10 @@ "searchPaths": [], "searchMicrosoftSymbolServer": false } + }, + "ignoreRunWithoutDebuggingWarnings": { + "description": "%c_cpp.debuggers.ignoreRunWithoutDebuggingWarnings.description%", + "default": false } } },