csharp4405de34 | 1 | #nullable enable |
| 2 | |
| 3 | using HybridCodebaseIndex.Core.Indexing; |
| 4 | |
| 5 | namespace CascadeIDE.Services.Intercom; |
| 6 | |
| 7 | /// <summary> |
| 8 | /// Строит Intercom symbol sidecar из текста, уже прочитанного HCI reindex (ADR 0135, 0141). |
| 9 | /// Один проход по диску — в Core. |
| 10 | /// </summary> |
| 11 | public sealed class IntercomSymbolLineHciReindexObserver : ICodebaseIndexReindexObserver |
| 12 | { |
| 13 | private readonly string? _solutionPath; |
| 14 | private readonly string _indexDirectoryRelative; |
| 15 | |
| 16 | public IntercomSymbolLineHciReindexObserver(string? solutionPath, string indexDirectoryRelative) |
| 17 | { |
| 18 | _solutionPath = string.IsNullOrWhiteSpace(solutionPath) ? null : solutionPath.Trim(); |
| 19 | _indexDirectoryRelative = string.IsNullOrWhiteSpace(indexDirectoryRelative) |
| 20 | ? ".hybrid-codebase-index" |
| 21 | : indexDirectoryRelative.Trim(); |
| 22 | } |
| 23 | |
| 24 | public void OnFileIndexed(IndexedFileEvent file) |
| 25 | { |
| 26 | if (!file.Extension.Equals(".cs", StringComparison.OrdinalIgnoreCase)) |
| 27 | return; |
| 28 | |
| 29 | var cache = new IntercomAttachResolveCacheContext( |
| 30 | file.WorkspaceRoot, |
| 31 | _solutionPath, |
| 32 | file.RelativePathUnix, |
| 33 | _indexDirectoryRelative); |
| 34 | |
| 35 | IntercomSymbolLineIndexBuilder.IndexFile( |
| 36 | cache, |
| 37 | file.AbsolutePath, |
| 38 | file.RelativePathUnix, |
| 39 | file.Text, |
| 40 | file.LastWriteUtcTicks); |
| 41 | } |
| 42 | } |
| 43 | |
View only · write via MCP/CIDE