Forge
csharp4405de34
1#nullable enable
2
3using CascadeIDE.Models.Intercom;
4
5namespace CascadeIDE.Services.Intercom;
6
7/// <summary>
8/// Нормализованный запрос кода для <c>/intercom message find</c> / relate (ADR 0137).
9/// Идентичность — <see cref="ResolvedAnchor"/> (memberKey, syntaxScope, shape); строки — снимок @ query time, не ключ.
10/// </summary>
11public sealed record IntercomCodeRefQuery(
12 string File,
13 int? LineStart,
14 int? LineEnd,
15 AttachmentAnchor? ResolvedAnchor = null)
16{
17 public bool HasLineRange => LineStart is not null && LineEnd is not null;
18
19 public string? MemberKey => ResolvedAnchor?.MemberKey;
20
21 public static IntercomCodeRefQuery FromAnchor(AttachmentAnchor anchor)
22 {
23 var file = (anchor.File ?? "").Replace('\\', '/');
24 int? start = anchor.LineStart;
25 int? end = anchor.LineEnd ?? anchor.LineStart;
26 if (end is not null && start is not null && end < start)
27 end = start;
28
29 return new IntercomCodeRefQuery(file, start, end, anchor);
30 }
31}
32
View only · write via MCP/CIDE