public DocumentSpanEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     DocumentSpan documentSpan,
     bool isDefinitionLocation,
     Guid projectGuid,
     SourceText sourceText,
     ClassifiedSpansAndHighlightSpan classifiedSpans)
     : base(context, definitionBucket, documentSpan, projectGuid, sourceText)
 {
     _isDefinitionLocation         = isDefinitionLocation;
     _classifiedSpansAndHighlights = classifiedSpans;
 }
Exemple #2
0
 public DocumentSpanEntry(
     AbstractTableDataSourceFindUsagesContext context,
     RoslynDefinitionBucket definitionBucket,
     DocumentSpan documentSpan,
     DocumentHighlighting.HighlightSpanKind spanKind,
     string documentName,
     Guid projectGuid,
     SourceText sourceText,
     ClassifiedSpansAndHighlightSpan classifiedSpans)
     : base(context, definitionBucket, documentSpan, documentName, projectGuid, sourceText)
 {
     _spanKind = spanKind;
     _classifiedSpansAndHighlights = classifiedSpans;
 }
Exemple #3
0
            public DocumentSpanEntry(
                TableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _documentSpan         = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _sourceText           = sourceText;
                _classifiedSpans      = classifiedSpans;
            }
            protected async Task <Entry> CreateDocumentSpanEntryAsync(
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                HighlightSpanKind spanKind)
            {
                var document = documentSpan.Document;

                var(guid, projectName, sourceText) = await GetGuidAndProjectNameAndSourceTextAsync(document).ConfigureAwait(false);

                var classifiedSpansAndHighlightSpan =
                    await ClassifiedSpansAndHighlightSpan.ClassifyAsync(documentSpan, CancellationToken).ConfigureAwait(false);

                return(new DocumentSpanEntry(
                           this, definitionBucket, documentSpan, spanKind,
                           projectName, guid, sourceText, classifiedSpansAndHighlightSpan));
            }
            public DocumentSpanEntry(
                TableDataSourceFindUsagesContext context,
                RoslynDefinitionBucket definitionBucket,
                DocumentSpan documentSpan,
                bool isDefinitionLocation,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpans)
                : base(definitionBucket)
            {
                _context = context;

                _documentSpan = documentSpan;
                _isDefinitionLocation = isDefinitionLocation;
                _sourceText = sourceText;
                _classifiedSpans = classifiedSpans;
            }
Exemple #6
0
            private static IList <System.Windows.Documents.Inline> GetHighlightedInlines(
                StreamingFindUsagesPresenter presenter,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpansAndHighlight,
                bool isDefinition)
            {
                var propertyId = isDefinition
                    ? DefinitionHighlightTag.TagId
                    : ReferenceHighlightTag.TagId;

                var properties = presenter._formatMapService
                                 .GetEditorFormatMap("text")
                                 .GetProperties(propertyId);
                var highlightBrush = properties["Background"] as Brush;

                var classifiedSpans = classifiedSpansAndHighlight.ClassifiedSpans;
                var classifiedTexts = classifiedSpans.SelectAsArray(
                    cs => new ClassifiedText(cs.ClassificationType, sourceText.ToString(cs.TextSpan)));

                var inlines = classifiedTexts.ToInlines(
                    presenter._typeMap,
                    runCallback: (run, classifiedText, position) =>
                {
                    if (highlightBrush != null)
                    {
                        if (position == classifiedSpansAndHighlight.HighlightSpan.Start)
                        {
                            run.SetValue(
                                System.Windows.Documents.TextElement.BackgroundProperty,
                                highlightBrush);
                        }
                    }
                });

                return(inlines);
            }
            private static IList<System.Windows.Documents.Inline> GetHighlightedInlines(
                StreamingFindUsagesPresenter presenter,
                SourceText sourceText,
                ClassifiedSpansAndHighlightSpan classifiedSpansAndHighlight,
                bool isDefinition)
            {
                var propertyId = isDefinition
                    ? DefinitionHighlightTag.TagId
                    : ReferenceHighlightTag.TagId;

                var properties = presenter._formatMapService
                                          .GetEditorFormatMap("text")
                                          .GetProperties(propertyId);
                var highlightBrush = properties["Background"] as Brush;

                var classifiedSpans = classifiedSpansAndHighlight.ClassifiedSpans;
                var classifiedTexts = classifiedSpans.SelectAsArray(
                    cs => new ClassifiedText(cs.ClassificationType, sourceText.ToString(cs.TextSpan)));

                var inlines = classifiedTexts.ToInlines(
                    presenter._typeMap,
                    runCallback: (run, classifiedText, position) =>
                    {
                        if (highlightBrush != null)
                        {
                            if (position == classifiedSpansAndHighlight.HighlightSpan.Start)
                            {
                                run.SetValue(
                                    System.Windows.Documents.TextElement.BackgroundProperty,
                                    highlightBrush);
                            }
                        }
                    });

                return inlines;
            }