Forge
csharp8f5a77c3
1#nullable enable
2
3using CascadeIDE.Services;
4
5namespace CascadeIDE.Services.Lsp;
6
7/// <summary>Общий цикл detach → dispose → start LSP (Wave C).</summary>
8public static class LanguageServerLifecycleCoordinator
9{
10 public static async Task<T?> RestartAsync<T>(
11 Func<T> captureSnapshotOnUi,
12 Action detachDiagnostics,
13 Action disposeHost,
14 Func<T, Task<T?>> startHostAsync,
15 Action<T?> attachDiagnostics,
16 Func<T, Task> reopenDocumentsAsync)
17 where T : class
18 {
19 var snap = captureSnapshotOnUi();
20 detachDiagnostics();
21 disposeHost();
22 var host = await startHostAsync(snap).ConfigureAwait(false);
23 attachDiagnostics(host);
24 if (host is not null)
25 await reopenDocumentsAsync(host).ConfigureAwait(false);
26 return host;
27 }
28}
29
View only · write via MCP/CIDE