Forge
csharp4405de34
1using CascadeIDE.Features.WorkspaceNavigation.Application;
2using CascadeIDE.Models;
3using CascadeIDE.ViewModels;
4
5namespace CascadeIDE.Services;
6
7/// <summary>Control-flow virtual spacing policy (ADR 0152); Monaco uses glyphs, lane constants for future layout.</summary>
8public static class EditorControlFlowLanePolicy
9{
10 public const double GlyphRadius = 6.2;
11 public const double LanePadding = 3.0;
12 public const double LaneWidthPixels = GlyphRadius * 2 + LanePadding * 2;
13 public const double LaneHalfWidth = LaneWidthPixels / 2;
14
15 public static bool ShouldReserveLane(
16 string? codeNavigationMapLevel,
17 string? cfAnchorFullPath,
18 string? filePath,
19 CodeNavigationMapGraphSceneVm? scene)
20 {
21 if (!string.Equals(
22 CodeNavigationMapLevelKind.Normalize(codeNavigationMapLevel),
23 CodeNavigationMapLevelKind.ControlFlow,
24 StringComparison.Ordinal))
25 return false;
26
27 if (string.IsNullOrEmpty(cfAnchorFullPath)
28 || string.IsNullOrWhiteSpace(filePath)
29 || !EditorTextCoordinateUtilities.PathsReferToSameFile(cfAnchorFullPath, filePath))
30 return false;
31
32 return scene is not null
33 && !scene.IsEmpty
34 && scene.Presentation == CodeNavigationMapGraphPresentationKind.CodeControlFlow;
35 }
36}
37
View only · write via MCP/CIDE