Esempio n. 1
0
        public async Task <QuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken)
        {
            var snapshot     = _textBuffer.CurrentSnapshot;
            var triggerPoint = session.GetTriggerPoint(snapshot);

            if (!triggerPoint.HasValue)
            {
                return(null);
            }

            var navigationsResult = await _navigationTokenService
                                    .GetNavigationsAsync(triggerPoint.Value)
                                    .ConfigureAwait(false);

            if (navigationsResult == null)
            {
                return(null);
            }

            var dataElement = await _descriptionBuilder
                              .GetColorizedDescriptionAsync(navigationsResult.Values, cancellationToken)
                              .ConfigureAwait(false);

            if (dataElement == null)
            {
                return(null);
            }

            var tokenSpan      = navigationsResult.ApplicableToken.Span;
            var applicableSpan = snapshot.CreateTrackingSpan(tokenSpan, SpanTrackingMode.EdgeInclusive);

            return(new QuickInfoItem(applicableSpan, dataElement));
        }
Esempio n. 2
0
 public Task <object> GetDescriptionAsync(IIntellisenseDescriptionBuilder descriptionBuilder, CancellationToken cancellationToken) =>
 descriptionBuilder.GetColorizedDescriptionAsync(_instructionNavigations, cancellationToken);