Forge
csharp4405de34
1namespace CascadeIDE.IdeDisplay.CockpitCommandLine;
2
3/// <summary>IDS: композитор оверлея Cockpit Command Line.</summary>
4public sealed class CockpitCommandLineSurfaceCompositor
5 : IIdsSurfaceCompositor<CockpitCommandLineSurfaceIntent, CockpitCommandLineSurfaceSnapshot>
6{
7 public CockpitCommandLineSurfaceSnapshot Compose(CockpitCommandLineSurfaceIntent intent)
8 {
9 if (!intent.ShowSuggestions || intent.Suggestions.Count == 0)
10 {
11 return new CockpitCommandLineSurfaceSnapshot(
12 intent.DraftText,
13 intent.CaretIndex,
14 intent.SelectedSuggestionIndex,
15 intent.Breadcrumb,
16 false,
17 []);
18 }
19
20 var items = new List<CockpitCommandLineSurfaceEntry>(intent.Suggestions.Count);
21 var selected = intent.SelectedSuggestionIndex;
22 for (var i = 0; i < intent.Suggestions.Count; i++)
23 {
24 var row = intent.Suggestions[i];
25 items.Add(new CockpitCommandLineSurfaceEntry(row.Title, row.Subtitle, i == selected));
26 }
27
28 return new CockpitCommandLineSurfaceSnapshot(
29 intent.DraftText,
30 intent.CaretIndex,
31 selected,
32 intent.Breadcrumb,
33 true,
34 items);
35 }
36}
37
View only · write via MCP/CIDE