Skip to content

Commit

Permalink
Enable Run menu in VS Code (#1711)
Browse files Browse the repository at this point in the history
The Run menu options for "Start Debugging" and "Run without Debugging"
were not working, in part to how the validation checking for the
presence of a launch.json. This reverses the if-statement and drops the
else condition to get recognition of single file scenarios without
launch.json. Confirmed via manual testing.
  • Loading branch information
swernli authored Jul 9, 2024
1 parent cc9f420 commit 623859b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions vscode/src/debugger/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,7 @@ class QsDebugConfigProvider implements vscode.DebugConfigurationProvider {
config: vscode.DebugConfiguration,
_token?: vscode.CancellationToken | undefined,
): vscode.ProviderResult<vscode.DebugConfiguration> {
// if launch.json is missing or empty
if (!config.type && !config.request && !config.name) {
const docUri = getActiveQSharpDocumentUri();
if (docUri) {
config.type = "qsharp";
config.name = "Launch";
config.request = "launch";
config.programUri = docUri.toString();
config.shots = 1;
config.noDebug = "noDebug" in config ? config.noDebug : false;
config.stopOnEntry = !config.noDebug;
}
} else if (config.program && folder) {
if (config.program && folder) {
// A program is specified in launch.json.
//
// Variable substitution is a bit odd in VS Code. Variables such as
Expand All @@ -148,6 +136,18 @@ class QsDebugConfigProvider implements vscode.DebugConfigurationProvider {
path: fileUri.path,
})
.toString();
} else {
// if launch.json is missing or empty, try to launch the active Q# document
const docUri = getActiveQSharpDocumentUri();
if (docUri) {
config.type = "qsharp";
config.name = "Launch";
config.request = "launch";
config.programUri = docUri.toString();
config.shots = 1;
config.noDebug = "noDebug" in config ? config.noDebug : false;
config.stopOnEntry = !config.noDebug;
}
}

log.trace(
Expand Down

0 comments on commit 623859b

Please sign in to comment.