| 1 | namespace CascadeIDE.Cockpit.ComputingUnits.IdeHealth; |
| 2 | |
| 3 | using CascadeIDE.Contracts; |
| 4 | using CascadeIDE.Services; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// CCU «debug сегмент»: собирает сегмент Debug из снимка DAP и решения области (solution/project). |
| 8 | /// Детализация строки для project scope делегируется <see cref="IdeHealthDebugSummaryUnit"/>. |
| 9 | /// </summary> |
| 10 | [ComputingUnit] |
| 11 | public sealed class IdeHealthDebugSegmentUnit : ICockpitComputeUnit |
| 12 | { |
| 13 | private readonly IdeHealthDebugSummaryUnit _summary = IdeHealthDebugSummaryUnit.Default; |
| 14 | |
| 15 | public static IdeHealthDebugSegmentUnit Default { get; } = new(); |
| 16 | |
| 17 | private IdeHealthDebugSegmentUnit() |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | public IdeHealthSegmentInput Compose(IdeHealthScopeDecision scopeDecision, in DebugSessionSnapshot snapshot) |
| 22 | { |
| 23 | if (scopeDecision.Scope == IdeHealthScope.Project && !string.IsNullOrWhiteSpace(scopeDecision.ProjectPath)) |
| 24 | { |
| 25 | var summary = _summary.Summarize(snapshot); |
| 26 | return IdeHealthFormattingUnit.Default.ProjectDebugSegment(scopeDecision.ProjectPath, summary); |
| 27 | } |
| 28 | |
| 29 | var variableCount = snapshot.VariableRootScopes.Sum(scope => scope.Roots.Count); |
| 30 | return IdeHealthFormattingUnit.Default.DebugSegment( |
| 31 | snapshot.HasActiveSession, |
| 32 | snapshot.IsExecutionStopped, |
| 33 | snapshot.StackFrames.Count, |
| 34 | variableCount); |
| 35 | } |
| 36 | } |
| 37 | |
View only · write via MCP/CIDE