/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/Core/Peek/ExternalFilePeekableItem.cs
51 строка
2 KB
Cyrus Najmabadi
Move files
25 апр 2025, 01:10
25 апр 2025, 01:10
46f9987
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System.Collections.Generic; using System.Threading; using Microsoft.VisualStudio.Language.Intellisense; namespace Microsoft.CodeAnalysis.Editor.Implementation.Peek; internal sealed class ExternalFilePeekableItem : PeekableItem { private readonly FileLinePositionSpan _span; private readonly IPeekRelationship _relationship; public ExternalFilePeekableItem( FileLinePositionSpan span, IPeekRelationship relationship, IPeekResultFactory peekResultFactory) : base(peekResultFactory) { _span = span; _relationship = relationship; } public override IEnumerable<IPeekRelationship> Relationships => [_relationship]; public override IPeekResultSource GetOrCreateResultSource(string relationshipName) => new ResultSource(this); private sealed class ResultSource : IPeekResultSource { private readonly ExternalFilePeekableItem _peekableItem; public ResultSource(ExternalFilePeekableItem peekableItem) => _peekableItem = peekableItem; public void FindResults(string relationshipName, IPeekResultCollection resultCollection, CancellationToken cancellationToken, IFindPeekResultsCallback callback) { if (relationshipName != _peekableItem._relationship.Name) { return; } resultCollection.Add(PeekHelpers.CreateDocumentPeekResult(_peekableItem._span.Path, _peekableItem._span.Span, _peekableItem._span.Span, _peekableItem.PeekResultFactory)); } } }