Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7250861
Adding Run Without Debugging feature
bobbrow Apr 3, 2026
448763e
Updates for WSL
bobbrow Apr 3, 2026
c315d20
Add support for linux terminals
bobbrow Apr 3, 2026
a86afd6
Add tests
bobbrow Apr 3, 2026
bb77661
address CodeQL issue
bobbrow Apr 3, 2026
2608547
set the console type based on debugger type
bobbrow Apr 3, 2026
9f9dd61
use shell integration on terminals that support it
bobbrow Apr 3, 2026
d59f6c0
Merge branch 'main' into bobbrow/runWithoutDebugging
bobbrow Apr 4, 2026
de0e20c
PR comments and placeholder for automation for later
bobbrow Apr 6, 2026
6008c13
warn the user if they try to do run without debugging in unsupported …
bobbrow Apr 6, 2026
da02611
Use buildShellCommandLine
bobbrow Apr 6, 2026
68dddd8
reinterpret internalConsole to be integratedTerminal
bobbrow Apr 7, 2026
da18921
set the MIMode explicitly
bobbrow Apr 7, 2026
ad01d4a
Fix the test to work with integratedTerminal mode
bobbrow Apr 7, 2026
a69ba2a
Change the test to read from file instead of exit code
bobbrow Apr 9, 2026
b94df3e
Merge branch 'main' into bobbrow/runWithoutDebugging
bobbrow Apr 9, 2026
44dda31
handle programs with spaces in the name for shell integration
bobbrow Apr 9, 2026
161627d
Addres feedback and test more launch combinations
bobbrow Apr 10, 2026
826e1d2
PowerShell is the default shell on Windows
bobbrow Apr 13, 2026
bd6eb8b
Merge branch 'main' into bobbrow/runWithoutDebugging
bobbrow Apr 13, 2026
cf48779
Merge branch 'main' into bobbrow/runWithoutDebugging
bobbrow Apr 13, 2026
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
12 changes: 12 additions & 0 deletions .github/workflows/job-compile-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ jobs:
# run: yarn test --scenario=MultirootDeadlockTest
# working-directory: Extension

# - name: Run E2E IntelliSense features tests
# if: ${{ inputs.platform == 'windows' }}
# run: yarn test --scenario=RunWithoutDebugging
# working-directory: Extension

# NOTE: For mac/linux run the tests with xvfb-action for UI support.
# Another way to start xvfb https://github.com/microsoft/vscode-test/blob/master/sample/azure-pipelines.yml

Expand All @@ -83,3 +88,10 @@ jobs:
# run: yarn test --scenario=MultirootDeadlockTest
# working-directory: Extension

# - name: Run E2E IntelliSense features tests (xvfb)
# if: ${{ inputs.platform == 'mac' || inputs.platform == 'linux' }}
# uses: coactions/setup-xvfb@v1
# with:
# run: yarn test --scenario=RunWithoutDebugging
# working-directory: Extension

4 changes: 4 additions & 0 deletions Extension/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
"label": "MultirootDeadlockTest ",
"value": "${workspaceFolder}/test/scenarios/MultirootDeadlockTest/assets/test.code-workspace"
},
{
"label": "RunWithoutDebugging ",
"value": "${workspaceFolder}/test/scenarios/RunWithoutDebugging/assets/"
},
{
"label": "SimpleCppProject ",
"value": "${workspaceFolder}/test/scenarios/SimpleCppProject/assets/simpleCppProject.code-workspace"
Expand Down
2 changes: 2 additions & 0 deletions Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
Telemetry.logDebuggerEvent(DebuggerEvent.debugPanel, { "debugType": DebugType.debug, "configSource": folder ? ConfigSource.workspaceFolder : ConfigSource.singleFile, "configMode": ConfigMode.noLaunchConfig, "cancelled": "true", "succeeded": "true" });
return undefined; // aborts debugging silently
} else {
const noDebug = config.noDebug ?? false; // Preserve the noDebug value from the config if it exists.
// Currently, we expect only one debug config to be selected.
console.assert(configs.length === 1, "More than one debug config is selected.");
config = configs[0];
// Keep track of the entry point where the debug config has been selected, for telemetry purposes.
config.debuggerEvent = DebuggerEvent.debugPanel;
config.configSource = folder ? ConfigSource.workspaceFolder : ConfigSource.singleFile;
config.noDebug = noDebug;
}
}

Expand Down
6 changes: 3 additions & 3 deletions Extension/src/Debugger/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function createLaunchString(name: string, type: string, executable: string): str
"stopAtEntry": false,
"cwd": "$\{fileDirname\}",
"environment": [],
${ type === "cppdbg" ? `"externalConsole": false` : `"console": "externalTerminal"` }
${type === "cppdbg" ? `"externalConsole": false` : `"console": "internalConsole"`}
`;
}

Expand Down Expand Up @@ -164,7 +164,7 @@ export class MIConfigurations extends Configuration {
\t${indentJsonString(createLaunchString(name, this.miDebugger, this.executable))},
\t"MIMode": "${this.MIMode}"{0}{1}
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);

return {
"label": configPrefix + name,
Expand All @@ -182,7 +182,7 @@ export class MIConfigurations extends Configuration {
\t${indentJsonString(createAttachString(name, this.miDebugger, this.executable))}
\t"MIMode": "${this.MIMode}"{0}{1}
}`, [this.miDebugger === "cppdbg" && os.platform() === "win32" ? `,${os.EOL}\t"miDebuggerPath": "/path/to/gdb"` : "",
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);
this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalProperties)}` : ""]);

return {
"label": configPrefix + name,
Expand Down
47 changes: 44 additions & 3 deletions Extension/src/Debugger/debugAdapterDescriptorFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import * as os from 'os';
import * as path from 'path';
import * as vscode from "vscode";
import * as nls from 'vscode-nls';
import { getOutputChannel } from '../logger';
import { RunWithoutDebuggingAdapter } from './runWithoutDebuggingAdapter';

nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();

// Registers DebugAdapterDescriptorFactory for `cppdbg` and `cppvsdbg`. If it is not ready, it will prompt a wait for the download dialog.
// Registers DebugAdapterDescriptorFactory for `cppdbg` and `cppvsdbg`.
// NOTE: This file is not automatically tested.

abstract class AbstractDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescriptorFactory {
Expand All @@ -26,8 +28,15 @@ abstract class AbstractDebugAdapterDescriptorFactory implements vscode.DebugAdap
}

export class CppdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterDescriptorFactory {
async createDebugAdapterDescriptor(session: vscode.DebugSession, _executable?: vscode.DebugAdapterExecutable): Promise<vscode.DebugAdapterDescriptor> {
if (session.configuration.noDebug) {
if (noDebugSupported(session.configuration)) {
return new vscode.DebugAdapterInlineImplementation(new RunWithoutDebuggingAdapter());
}
// If the configuration is not supported, gracefully fall back to a regular debug session and log a message to the user.
logReasonForNoDebugNotSupported(session.configuration);
}

async createDebugAdapterDescriptor(_session: vscode.DebugSession, _executable?: vscode.DebugAdapterExecutable): Promise<vscode.DebugAdapterDescriptor> {
const adapter: string = "./debugAdapters/bin/OpenDebugAD7" + (os.platform() === 'win32' ? ".exe" : "");

const command: string = path.join(this.context.extensionPath, adapter);
Expand All @@ -37,8 +46,15 @@ export class CppdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterDes
}

export class CppvsdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterDescriptorFactory {
async createDebugAdapterDescriptor(session: vscode.DebugSession, _executable?: vscode.DebugAdapterExecutable): Promise<vscode.DebugAdapterDescriptor | null> {
if (session.configuration.noDebug) {
if (noDebugSupported(session.configuration)) {
return new vscode.DebugAdapterInlineImplementation(new RunWithoutDebuggingAdapter());
}
// If the configuration is not supported, gracefully fall back to a regular debug session and log a message to the user.
logReasonForNoDebugNotSupported(session.configuration);
}

async createDebugAdapterDescriptor(_session: vscode.DebugSession, _executable?: vscode.DebugAdapterExecutable): Promise<vscode.DebugAdapterDescriptor | null> {
if (os.platform() !== 'win32') {
void vscode.window.showErrorMessage(localize("debugger.not.available", "Debugger type '{0}' is not available for non-Windows machines.", "cppvsdbg"));
return null;
Expand All @@ -50,3 +66,28 @@ export class CppvsdbgDebugAdapterDescriptorFactory extends AbstractDebugAdapterD
}
}
}

function noDebugSupported(configuration: vscode.DebugConfiguration): boolean {
// Don't attempt to start a noDebug session if the configuration has any of these properties, which require a debug adapter to function.
return configuration.request === 'launch' && !configuration.pipeTransport && !configuration.debugServerPath && !configuration.miDebuggerServerAddress && !configuration.coreDumpPath;
}

function logReasonForNoDebugNotSupported(configuration: vscode.DebugConfiguration): void {
const outputChannel = getOutputChannel();
if (configuration.request !== 'launch') {
outputChannel.appendLine(localize("debugger.noDebug.requestType.not.supported", "Run Without Debugging is only supported for launch configurations."));
}
if (configuration.pipeTransport) {
outputChannel.appendLine(localize("debugger.noDebug.pipeTransport.not.supported", "Run Without Debugging is not supported for configurations with 'pipeTransport' set."));
}
if (configuration.debugServerPath) {
outputChannel.appendLine(localize("debugger.noDebug.debugServerPath.not.supported", "Run Without Debugging is not supported for configurations with 'debugServerPath' set."));
}
if (configuration.miDebuggerServerAddress) {
outputChannel.appendLine(localize("debugger.noDebug.miDebuggerServerAddress.not.supported", "Run Without Debugging is not supported for configurations with 'miDebuggerServerAddress' set."));
}
if (configuration.coreDumpPath) {
outputChannel.appendLine(localize("debugger.noDebug.coreDumpPath.not.supported", "Run Without Debugging is not supported for configurations with 'coreDumpPath' set."));
}
outputChannel.show(true);
}
Loading
Loading