Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"aspire-vscode.strings.csharpSupportNotEnabled": "C# support is not enabled in this workspace. This project should have started through the Aspire CLI.",
"aspire-vscode.strings.failedToStartProject": "Failed to start project: {0}.",
"aspire-vscode.strings.dcpServerNotInitialized": "DCP server not initialized - cannot forward debug output.",
"aspire-vscode.strings.appHostSessionTerminated": "The apphost process has terminated. To view console output, select the apphost session from the debug console dropdown.",
"aspire-vscode.strings.invalidTokenProvided": "Invalid token provided.",
"aspire-vscode.strings.noWorkspaceFolder": "No workspace folder found.",
"aspire-vscode.strings.aspireConfigExists": "Aspire launch configuration already exists in launch.json.",
Expand Down
23 changes: 16 additions & 7 deletions extension/src/debugger/AspireDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { AspireResourceExtendedDebugConfiguration, AspireResourceDebugSession, E
import { extensionLogOutputChannel } from "../utils/logging";
import AspireDcpServer, { generateDcpIdPrefix } from "../dcp/AspireDcpServer";
import { spawnCliProcess } from "./languages/cli";
import { disconnectingFromSession, launchingWithAppHost, launchingWithDirectory, processExceptionOccurred, processExitedWithCode, aspireDashboard } from "../loc/strings";
import { disconnectingFromSession, launchingWithAppHost, launchingWithDirectory, processExceptionOccurred, processExitedWithCode, aspireDashboard, appHostSessionTerminated } from "../loc/strings";
import { projectDebuggerExtension } from "./languages/dotnet";
import { AnsiColors } from "../utils/AspireTerminalProvider";
import { applyTextStyle } from "../utils/strings";
import { nodeDebuggerExtension } from "./languages/node";
import { cleanupRun } from "./runCleanupRegistry";
import AspireRpcServer from "../server/AspireRpcServer";
Expand Down Expand Up @@ -239,13 +241,16 @@ export class AspireDebugSession implements vscode.DebugAdapter {
// When the user clicks "restart" on the app host child session,
// we suppress VS Code's automatic child restart and restart the
// entire Aspire debug session instead.
this.createDebugAdapterTrackerCore(debuggerExtension.debugAdapter, (debugSessionId) => {
if (debugSessionId === this.debugSessionId) {
this._appHostRestartRequested = true;
return true; // suppress VS Code's child restart
this.createDebugAdapterTrackerCore(
debuggerExtension.debugAdapter,
(debugSessionId) => {
if (debugSessionId === this.debugSessionId) {
this._appHostRestartRequested = true;
return true; // suppress VS Code's child restart
}
return false;
}
return false;
});
);

let appHostArgs: string[];
let launchConfig;
Expand Down Expand Up @@ -290,6 +295,10 @@ export class AspireDebugSession implements vscode.DebugAdapter {

const disposable = vscode.debug.onDidTerminateDebugSession(async session => {
if (this._appHostDebugSession && session.id === this._appHostDebugSession.id) {
if (!this._appHostRestartRequested) {
this.sendMessageWithEmoji("ℹ️", applyTextStyle(appHostSessionTerminated, AnsiColors.Yellow));
}

// Only restart the Aspire session when the user explicitly clicked
// "restart" on the app host debug toolbar (detected via DAP tracker).
// All other cases (user stop, process crash/exit) just dispose.
Expand Down
1 change: 1 addition & 0 deletions extension/src/loc/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const failedToStartPythonProgram = (errorMessage: string) => vscode.l10n.
export const csharpSupportNotEnabled = vscode.l10n.t('C# support is not enabled in this workspace. This project should have started through the Aspire CLI.');
export const failedToStartProject = (errorMessage: string) => vscode.l10n.t('Failed to start project: {0}.', errorMessage);
export const dcpServerNotInitialized = vscode.l10n.t('DCP server not initialized - cannot forward debug output.');
export const appHostSessionTerminated = vscode.l10n.t('The apphost process has terminated. To view console output, select the apphost session from the debug console dropdown.');
export const invalidTokenProvided = vscode.l10n.t('Invalid token provided.');
export const noWorkspaceFolder = vscode.l10n.t('No workspace folder found.');
export const aspireConfigExists = vscode.l10n.t('Aspire launch configuration already exists in launch.json.');
Expand Down
1 change: 1 addition & 0 deletions extension/src/utils/AspireTerminalProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import path from 'path';

export const enum AnsiColors {
Green = '\x1b[32m',
Yellow = '\x1b[33m',
Blue = '\x1b[34m',
}

Expand Down
11 changes: 11 additions & 0 deletions playground/AzureFunctionsEndToEnd.TypeScript/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "aspire",
"request": "launch",
"name": "Aspire: Launch default apphost",
"program": "${workspaceFolder}"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
02C050302BF2388A87AE0E8B5C0E64E0146DBFA457409DA99D8EBF1DD30A95B6
Loading
Loading