Exemplo n.º 1
0
        public FrameworkElement CreateFrameworkElement(IDeferredQuickInfoContent deferredContent, DeferredContentFrameworkElementFactory factory)
        {
            var quickInfoDisplay = (QuickInfoDisplayDeferredContent)deferredContent;
            FrameworkElement warningGlyphElement = null;

            if (quickInfoDisplay.WarningGlyph != null)
            {
                warningGlyphElement = factory.CreateElement(quickInfoDisplay.WarningGlyph);
            }

            FrameworkElement symbolGlyphElement = null;

            if (quickInfoDisplay.SymbolGlyph != null)
            {
                symbolGlyphElement = factory.CreateElement(quickInfoDisplay.SymbolGlyph);
            }

            return(new QuickInfoDisplayPanel(
                       symbolGlyphElement,
                       warningGlyphElement,
                       factory.CreateElement(quickInfoDisplay.MainDescription),
                       factory.CreateElement(quickInfoDisplay.Documentation),
                       factory.CreateElement(quickInfoDisplay.TypeParameterMap),
                       factory.CreateElement(quickInfoDisplay.AnonymousTypes),
                       factory.CreateElement(quickInfoDisplay.UsageText),
                       factory.CreateElement(quickInfoDisplay.ExceptionText)));
        }
Exemplo n.º 2
0
 public QuickInfoDisplayDeferredContent(IDeferredQuickInfoContent?symbolGlyph, IDeferredQuickInfoContent?warningGlyph, IDeferredQuickInfoContent mainDescription, IDeferredQuickInfoContent documentation, IDeferredQuickInfoContent typeParameterMap, IDeferredQuickInfoContent anonymousTypes, IDeferredQuickInfoContent usageText, IDeferredQuickInfoContent exceptionText)
 {
     _symbolGlyph      = symbolGlyph;
     _warningGlyph     = warningGlyph;
     _mainDescription  = mainDescription;
     _documentation    = documentation;
     _typeParameterMap = typeParameterMap;
     _anonymousTypes   = anonymousTypes;
     _usageText        = usageText;
     _exceptionText    = exceptionText;
 }
        public FrameworkElement CreateFrameworkElement(IDeferredQuickInfoContent deferredContent, DeferredContentFrameworkElementFactory factory)
        {
            var classifiableContent = (ClassifiableDeferredContent)deferredContent;
            var formatMap           = _classificationFormatMapService.GetClassificationFormatMap("tooltip");
            var classifiedTextBlock = classifiableContent.ClassifiableContent.ToTextBlock(formatMap, _typeMap);

            if (classifiedTextBlock.Inlines.Count == 0)
            {
                classifiedTextBlock.Visibility = Visibility.Collapsed;
            }

            return(classifiedTextBlock);
        }
 public QuickInfoDisplayDeferredContent(
     IDeferredQuickInfoContent symbolGlyph,
     IDeferredQuickInfoContent warningGlyph,
     IDeferredQuickInfoContent mainDescription,
     IDeferredQuickInfoContent documentation,
     IDeferredQuickInfoContent typeParameterMap,
     IDeferredQuickInfoContent anonymousTypes,
     IDeferredQuickInfoContent usageText)
 {
     _symbolGlyph = symbolGlyph;
     _warningGlyph = warningGlyph;
     _mainDescription = mainDescription;
     _documentation = documentation;
     _typeParameterMap = typeParameterMap;
     _anonymousTypes = anonymousTypes;
     _usageText = usageText;
 }
Exemplo n.º 5
0
 protected IDeferredQuickInfoContent CreateQuickInfoDisplayDeferredContent(
     Glyph glyph,
     IList <SymbolDisplayPart> mainDescription,
     IDeferredQuickInfoContent documentation,
     IList <SymbolDisplayPart> typeParameterMap,
     IList <SymbolDisplayPart> anonymousTypes,
     IList <SymbolDisplayPart> usageText)
 {
     return(new QuickInfoDisplayDeferredContent(
                symbolGlyph: new SymbolGlyphDeferredContent(glyph, _glyphService),
                warningGlyph: null,
                mainDescription: CreateClassifiableDeferredContent(mainDescription),
                documentation: documentation,
                typeParameterMap: CreateClassifiableDeferredContent(typeParameterMap),
                anonymousTypes: CreateClassifiableDeferredContent(anonymousTypes),
                usageText: CreateClassifiableDeferredContent(usageText)));
 }
        public FrameworkElement CreateFrameworkElement(IDeferredQuickInfoContent deferredContent, DeferredContentFrameworkElementFactory factory)
        {
            var documentationCommentContent = (DocumentationCommentDeferredContent)deferredContent;

            var documentationTextBlock = new TextBlock()
            {
                TextWrapping = TextWrapping.Wrap
            };

            var formatMap = _classificationFormatMapService.GetClassificationFormatMap("tooltip");

            documentationTextBlock.SetDefaultTextProperties(formatMap);

            // If we have already computed the symbol documentation by now, update

            UpdateDocumentationTextBlock(documentationCommentContent, documentationTextBlock);
            return(documentationTextBlock);
        }
Exemplo n.º 7
0
 public QuickInfoDisplayDeferredContent(
     IDeferredQuickInfoContent symbolGlyph,
     IDeferredQuickInfoContent warningGlyph,
     IDeferredQuickInfoContent mainDescription,
     IDeferredQuickInfoContent documentation,
     IDeferredQuickInfoContent typeParameterMap,
     IDeferredQuickInfoContent anonymousTypes,
     IDeferredQuickInfoContent usageText,
     IDeferredQuickInfoContent exceptionText)
 {
     SymbolGlyph      = symbolGlyph;
     WarningGlyph     = warningGlyph;
     MainDescription  = mainDescription;
     Documentation    = documentation;
     TypeParameterMap = typeParameterMap;
     AnonymousTypes   = anonymousTypes;
     UsageText        = usageText;
     ExceptionText    = exceptionText;
 }
Exemplo n.º 8
0
        public FrameworkElement CreateFrameworkElement(IDeferredQuickInfoContent deferredContent, DeferredContentFrameworkElementFactory factory)
        {
            var symbolDeferredContent = (SymbolGlyphDeferredContent)deferredContent;

            var image = new CrispImage
            {
                Moniker = symbolDeferredContent.Glyph.GetImageMoniker(),
            };

            // Inform the ImageService of the background color so that images have the correct background.
            var binding = new Binding("Background")
            {
                Converter      = new BrushToColorConverter(),
                RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(QuickInfoDisplayPanel), 1)
            };

            image.SetBinding(ImageThemingUtilities.ImageBackgroundColorProperty, binding);
            return(image);
        }
        internal FrameworkElement CreateElement(IDeferredQuickInfoContent deferredContent)
        {
            var deferredContentFullName = deferredContent.GetType().FullName;
            Lazy <IDeferredQuickInfoContentToFrameworkElementConverter> converter;

            if (!_convertersByTypeFullName.TryGetValue(deferredContentFullName, out converter))
            {
                // The content must be of a type we didn't have MEF deferred metadata for. Realize the
                // ones without MEF metadata, forcing everything to load.
                foreach (var converterWithoutMetadata in _convertersWithoutMetadata)
                {
                    _convertersByTypeFullName[converterWithoutMetadata.Value.GetApplicableType().FullName] =
                        new Lazy <IDeferredQuickInfoContentToFrameworkElementConverter>(() => converterWithoutMetadata.Value);
                }

                Contract.ThrowIfFalse(_convertersByTypeFullName.TryGetValue(deferredContentFullName, out converter));
            }

            return(converter.Value.CreateFrameworkElement(deferredContent, this));
        }
Exemplo n.º 10
0
 protected IDeferredQuickInfoContent CreateQuickInfoDisplayDeferredContent(
     Glyph glyph,
     IList <TaggedText> mainDescription,
     IDeferredQuickInfoContent documentation,
     IList <TaggedText> typeParameterMap,
     IList <TaggedText> anonymousTypes,
     IList <TaggedText> usageText,
     IList <TaggedText> exceptionText)
 {
     return(new QuickInfoDisplayDeferredContent(
                symbolGlyph: new SymbolGlyphDeferredContent(glyph),
                warningGlyph: null,
                mainDescription: CreateClassifiableDeferredContent(mainDescription),
                documentation: documentation,
                typeParameterMap: CreateClassifiableDeferredContent(typeParameterMap),
                anonymousTypes: CreateClassifiableDeferredContent(anonymousTypes),
                usageText: CreateClassifiableDeferredContent(usageText),
                exceptionText: CreateClassifiableDeferredContent(exceptionText),
                capturesText: null));
 }
Exemplo n.º 11
0
 public IDeferredQuickInfoContent CreateQuickInfoDisplayDeferredContent(
     ISymbol symbol,
     bool showWarningGlyph,
     bool showSymbolGlyph,
     IList <TaggedText> mainDescription,
     IDeferredQuickInfoContent documentation,
     IList <TaggedText> typeParameterMap,
     IList <TaggedText> anonymousTypes,
     IList <TaggedText> usageText,
     IList <TaggedText> exceptionText)
 {
     return(new QuickInfoDisplayDeferredContent(
                symbolGlyph: showSymbolGlyph ? CreateGlyphDeferredContent(symbol) : null,
                warningGlyph: showWarningGlyph ? CreateWarningGlyph() : null,
                mainDescription: CreateClassifiableDeferredContent(mainDescription),
                documentation: documentation,
                typeParameterMap: CreateClassifiableDeferredContent(typeParameterMap),
                anonymousTypes: CreateClassifiableDeferredContent(anonymousTypes),
                usageText: CreateClassifiableDeferredContent(usageText),
                exceptionText: CreateClassifiableDeferredContent(exceptionText)));
 }
 // DO NOT REMOVE: compat for Typescript
 public QuickInfoDisplayDeferredContent(
     IDeferredQuickInfoContent symbolGlyph,
     IDeferredQuickInfoContent warningGlyph,
     IDeferredQuickInfoContent mainDescription,
     IDeferredQuickInfoContent documentation,
     IDeferredQuickInfoContent typeParameterMap,
     IDeferredQuickInfoContent anonymousTypes,
     IDeferredQuickInfoContent usageText,
     IDeferredQuickInfoContent exceptionText)
     : this(
         symbolGlyph,
         warningGlyph,
         mainDescription,
         documentation,
         typeParameterMap,
         anonymousTypes,
         usageText,
         exceptionText,
         capturesText : new ClassifiableDeferredContent(new List <TaggedText>()))
 {
 }
Exemplo n.º 13
0
 protected IDeferredQuickInfoContent CreateQuickInfoDisplayDeferredContent(
     ISymbol symbol,
     bool showWarningGlyph,
     bool showSymbolGlyph,
     IList<SymbolDisplayPart> mainDescription,
     IDeferredQuickInfoContent documentation,
     IList<SymbolDisplayPart> typeParameterMap,
     IList<SymbolDisplayPart> anonymousTypes,
     IList<SymbolDisplayPart> usageText,
     IList<SymbolDisplayPart> exceptionText)
 {
     return new QuickInfoDisplayDeferredContent(
         symbolGlyph: showSymbolGlyph ? CreateGlyphDeferredContent(symbol) : null,
         warningGlyph: showWarningGlyph ? CreateWarningGlyph() : null,
         mainDescription: CreateClassifiableDeferredContent(mainDescription),
         documentation: documentation,
         typeParameterMap: CreateClassifiableDeferredContent(typeParameterMap),
         anonymousTypes: CreateClassifiableDeferredContent(anonymousTypes),
         usageText: CreateClassifiableDeferredContent(usageText),
         exceptionText: CreateClassifiableDeferredContent(exceptionText));
 }
Exemplo n.º 14
0
 internal FrameworkElement CreateElement(IDeferredQuickInfoContent deferredContent)
 {
     return(_convertersByType[deferredContent.GetType()].CreateFrameworkElement(deferredContent, this));
 }
        private static void AssertTextAndClassifications(string expectedText, FormattedClassification[] expectedClassifications, IDeferredQuickInfoContent actualContent)
        {
            var actualClassifications = ((ClassifiableDeferredContent)actualContent).ClassifiableContent;

            ClassificationTestHelper.VerifyTextAndClassifications(expectedText, expectedClassifications, actualClassifications);
        }
Exemplo n.º 16
0
        public FrameworkElement CreateFrameworkElement(IDeferredQuickInfoContent deferredContent, DeferredContentFrameworkElementFactory factory)
        {
            var projectionBufferDeferredContent = (ProjectionBufferDeferredContent)deferredContent;

            return(new ViewHostingControl(buffer => CreateView(projectionBufferDeferredContent, buffer), () => CreateBuffer(projectionBufferDeferredContent)));
        }
Exemplo n.º 17
0
 public QuickInfoItem(TextSpan textSpan, IDeferredQuickInfoContent content)
 {
     this.TextSpan = textSpan;
     this.Content  = content;
 }
Exemplo n.º 18
0
 public QuickInfoItem(TextSpan textSpan, IDeferredQuickInfoContent content)
 {
     this.TextSpan = textSpan;
     this.Content = content;
 }
Exemplo n.º 19
0
 protected IDeferredQuickInfoContent CreateQuickInfoDisplayDeferredContent(
     Glyph glyph,
     IList<TaggedText> mainDescription,
     IDeferredQuickInfoContent documentation,
     IList<TaggedText> typeParameterMap,
     IList<TaggedText> anonymousTypes,
     IList<TaggedText> usageText,
     IList<TaggedText> exceptionText)
 {
     return new QuickInfoDisplayDeferredContent(
         symbolGlyph: new SymbolGlyphDeferredContent(glyph, _glyphService),
         warningGlyph: null,
         mainDescription: CreateClassifiableDeferredContent(mainDescription),
         documentation: documentation,
         typeParameterMap: CreateClassifiableDeferredContent(typeParameterMap),
         anonymousTypes: CreateClassifiableDeferredContent(anonymousTypes),
         usageText: CreateClassifiableDeferredContent(usageText),
         exceptionText: CreateClassifiableDeferredContent(exceptionText));
 }