diff --git a/CHANGELOG.md b/CHANGELOG.md index 705925f9ab..d29e281669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) # 2.89.x +* Register Blazor WASM debugger in Razor Cohosting (PR: [#8511](https://github.com/dotnet/vscode-csharp/pull/8511)) # 2.88.x * Enable Razor Cohosting "on" by default (PR: [#8469](https://github.com/dotnet/vscode-csharp/pull/8469)) diff --git a/src/lsptoolshost/razor/razorEndpoints.ts b/src/lsptoolshost/razor/razorEndpoints.ts index 2ca105d4bc..125528dbcf 100644 --- a/src/lsptoolshost/razor/razorEndpoints.ts +++ b/src/lsptoolshost/razor/razorEndpoints.ts @@ -52,6 +52,7 @@ import { FormattingHandler } from '../../razor/src/formatting/formattingHandler' import { ReportIssueCommand } from '../../razor/src/diagnostics/reportIssueCommand'; import { HtmlDocument } from './htmlDocument'; import { HtmlForwardedRequest } from './htmlForwardedRequest'; +import { BlazorDebugConfigurationProvider } from '../../razor/src/blazorDebug/blazorDebugConfigurationProvider'; export function registerRazorEndpoints( context: vscode.ExtensionContext, @@ -67,6 +68,8 @@ export function registerRazorEndpoints( if (razorOptions.cohostingEnabled) { vscode.commands.executeCommand('setContext', 'razor.mode', 'cohosting'); registerCohostingEndpoints(); + + context.subscriptions.push(BlazorDebugConfigurationProvider.register(razorLogger, vscode)); } else { vscode.commands.executeCommand('setContext', 'razor.mode', 'lsp'); registerNonCohostingEndpoints(); diff --git a/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts b/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts index db9498416d..b192a04019 100644 --- a/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts +++ b/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts @@ -23,6 +23,11 @@ export class BlazorDebugConfigurationProvider implements vscode.DebugConfigurati constructor(private readonly logger: RazorLogger, private readonly vscodeType: typeof vscode) {} + public static register(logger: RazorLogger, vscodeType: typeof vscode) { + const provider = new BlazorDebugConfigurationProvider(logger, vscodeType); + return vscodeType.debug.registerDebugConfigurationProvider('blazorwasm', provider); + } + public async resolveDebugConfiguration( folder: vscode.WorkspaceFolder | undefined, configuration: vscode.DebugConfiguration diff --git a/src/razor/src/extension.ts b/src/razor/src/extension.ts index 43c12221e3..1374ac4bf8 100644 --- a/src/razor/src/extension.ts +++ b/src/razor/src/extension.ts @@ -310,8 +310,7 @@ export async function activate( localRegistrations.length = 0; }); - const provider = new BlazorDebugConfigurationProvider(logger, vscodeType); - context.subscriptions.push(vscodeType.debug.registerDebugConfigurationProvider('blazorwasm', provider)); + context.subscriptions.push(BlazorDebugConfigurationProvider.register(logger, vscodeType)); languageServerClient.onStarted(async () => { await documentManager.initialize();