csharpdeeb25a2 | 1 | #nullable enable |
| 2 | |
| 3 | namespace CascadeIDE.Features.Chat; |
| 4 | |
| 5 | /// <summary>Preview slash intercom по <c>intercom_handler</c> из каталога (не по hardcoded path).</summary> |
| 6 | internal static class SlashIntercomPreviewPolicies |
| 7 | { |
| 8 | public static bool TryBuild( |
| 9 | string slashPath, |
| 10 | string? argTail, |
| 11 | SlashCommandAnchorPreviewResolver? resolveAnchor, |
| 12 | out SlashCommandPreviewResult result) |
| 13 | { |
| 14 | result = default; |
| 15 | if (!SlashRouteCatalogIndex.TryGetIntercomHandler(slashPath, out var handlerId)) |
| 16 | return false; |
| 17 | |
| 18 | switch (handlerId) |
| 19 | { |
| 20 | case ChatSlashIntercomHandlers.Ids.MessageSelect: |
| 21 | result = SlashCommandPreviewRuleHelpers.BuildParametricPreview( |
| 22 | argTail ?? "", |
| 23 | "Сообщения", |
| 24 | slashPath); |
| 25 | return true; |
| 26 | |
| 27 | case ChatSlashIntercomHandlers.Ids.MessageSelectClear: |
| 28 | { |
| 29 | var tail = (argTail ?? "").Trim(); |
| 30 | result = tail.Length > 0 |
| 31 | ? new("Ожидается «/intercom message select clear» без аргументов.", SlashCommandPreviewKind.Error) |
| 32 | : new("Сбросить подсветку сообщений в detail-ленте.", SlashCommandPreviewKind.Ok); |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | case ChatSlashIntercomHandlers.Ids.MessageAnchorsList: |
| 37 | result = new("Готово: список якорей сообщения и черновика.", SlashCommandPreviewKind.Ok); |
| 38 | return true; |
| 39 | |
| 40 | case ChatSlashIntercomHandlers.Ids.AnchorPeek: |
| 41 | result = SlashCommandPreviewRuleHelpers.BuildAnchorPeek( |
| 42 | SlashPathAliases.ExtractPeekArgs(slashPath, argTail), |
| 43 | resolveAnchor); |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | return false; |
| 48 | } |
| 49 | } |
| 50 | |
View only · write via MCP/CIDE