Hot reload as a third launch mode, rewritten from dotnet-hot-reload

dotnet watch run with the startup project, configuration, platform and
per-project launch options from the status bar. The debugger is no
longer attached automatically: attach on demand, one notification with
Re-attach when the watcher replaces the process. Rude edits follow a
setting (restart / ask / warn). Warns before starting under an optimised
configuration, which SDK 10's dotnet watch cannot hot reload. Solution
build runs first so the Editor's post-build step finds the Builder.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169iPWwKHZoBTNN9qwXiwqk
This commit is contained in:
max
2026-09-08 13:47:37 +02:00
co-authored by Claude Fable 5.1
parent 63de8a31f6
commit 0cae24a1f0
10 changed files with 1164 additions and 9 deletions
+13 -1
View File
@@ -6,10 +6,12 @@ import { configurationKey, projectConfigurationFor, SolutionConfiguration } from
import { ALL_TARGETS, createTask, runTask, SolutionTaskProvider, TASK_TYPE, taskLabel, BuildTarget } from './tasks';
import { launchOptionsFor } from './launch';
import { StatusBar } from './status';
import { HotReloadController } from './hotreload/controller';
let model: SolutionModel;
let status: StatusBar;
let log: vscode.OutputChannel;
let hotReload: HotReloadController;
function settings() {
return vscode.workspace.getConfiguration('dotnetSolution');
@@ -303,13 +305,14 @@ export function activate(context: vscode.ExtensionContext): void {
log = vscode.window.createOutputChannel('.NET Solution');
model = new SolutionModel(context.workspaceState, log);
status = new StatusBar(model);
hotReload = new HotReloadController(model, log, () => build('build'));
const active = () => model.active;
const command = (id: string, handler: (...args: unknown[]) => unknown) =>
vscode.commands.registerCommand(id, handler);
context.subscriptions.push(
log, model, status,
log, model, status, hotReload,
vscode.tasks.registerTaskProvider(TASK_TYPE, new SolutionTaskProvider(model)),
vscode.debug.registerDebugConfigurationProvider(
@@ -328,6 +331,15 @@ export function activate(context: vscode.ExtensionContext): void {
command('dotnetSolution.debug', () => launch(false)),
command('dotnetSolution.run', () => launch(true)),
command('dotnetSolution.generateLaunchConfig', generateLaunchConfig),
command('dotnetSolution.hotReload.start', () => hotReload.start()),
command('dotnetSolution.hotReload.apply', () => hotReload.apply()),
command('dotnetSolution.hotReload.restart', () => hotReload.restart()),
command('dotnetSolution.hotReload.stop', () => hotReload.stop()),
command('dotnetSolution.hotReload.attach', () => hotReload.attach()),
command('dotnetSolution.hotReload.detach', () => hotReload.detach()),
command('dotnetSolution.hotReload.showTerminal', () => hotReload.showTerminal()),
command('dotnetSolution.hotReload.menu', () => hotReload.menu()),
command('dotnetSolution.reload', () => model.reload()),
command('dotnetSolution.showOutput', () => log.show()),
command('dotnetSolution.setStartupProject', async (resource?: unknown) => {