public static ImmutableList <NavigationBarItem> Build(SyntaxTreeAndSnapshot codeGenerationUnitAndSnapshot)
        {
            var syntaxRoot = codeGenerationUnitAndSnapshot?.SyntaxTree.Root as GuiDescriptionSyntax;

            return(NavigatableSections.GetItems(syntaxRoot)
                   .Select(item => new NavigationBarItem(
                               displayName: item.DisplayName,
                               imageMoniker: GdImageMonikers.GetMoniker(item.Glyph),
                               extent: item.Extent,
                               navigationPoint: item.NavigationPoint))
                   .ToImmutableList());
        }
        public async Task <QuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken)
        {
            await Task.Yield().ConfigureAwait(false);

            if (cancellationToken.IsCancellationRequested)
            {
                return(null);
            }

            var syntaxTreeAndSnapshot = ParserService.SyntaxTreeAndSnapshot;

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

            // Map the trigger point down to our buffer.
            SnapshotPoint?triggerPoint = session.GetTriggerPoint(syntaxTreeAndSnapshot.Snapshot);

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

            var qiInfo = QuickInfoProvider.GetQuickInfoDefinition(syntaxTreeAndSnapshot.SyntaxTree, triggerPoint.Value.Position);

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

            var applicableToSpan = syntaxTreeAndSnapshot.Snapshot.CreateTrackingSpan(
                qiInfo.ApplicableToExtent.Start,
                qiInfo.ApplicableToExtent.Length,
                SpanTrackingMode.EdgeExclusive);

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            var qiContent = _textBlockBuilderService.ToTextBlock(qiInfo.Content);

            var controlControl = new SymbolQuickInfoControl {
                CrispImage  = { Moniker = GdImageMonikers.GetMoniker(qiInfo.Glyph) },
                TextContent = { Content = qiContent }
            };

            var qiItem = new QuickInfoItem(applicableToSpan: applicableToSpan,
                                           item: controlControl
                                           );

            return(qiItem);
        }
Beispiel #3
0
        public void CheckGlyphMapping()
        {
            foreach (var glyph in Enum.GetValues(typeof(Glyph)).OfType <Glyph>())
            {
                if (!GdImageMonikers.HasImageMoniker(glyph))
                {
                    var msg = $"Es exisitert kein Mapping für Glyph.{glyph} in der Klasse {typeof(GdImageMonikers)}.Mapping\r\n" +
                              "Folgender Eintrag fehlt:\r\n" +
                              $"{{Glyph.{glyph}, KnownMonikers.{glyph}}}";

                    Assert.That(false, msg);
                }
            }
        }
Beispiel #4
0
 public void CheckFromGlyph()
 {
     foreach (var glyph in Enum.GetValues(typeof(Glyph)).OfType <Glyph>())
     {
         var moniker = GdImageMonikers.GetMoniker(glyph);
         if (glyph != Glyph.None)
         {
             Assert.That(moniker, Is.Not.EqualTo(default(ImageMoniker)));
         }
         else
         {
             Assert.That(moniker, Is.EqualTo(default(ImageMoniker)));
         }
     }
 }
        private void AddOutlineElement(TreeViewItem parent, [CanBeNull] OutlineElement outline, [CanBeNull] IPatternMatcher patternMatcher)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (parent == null)
            {
                TreeView.Items.Clear();
                _flattenTree.Clear();
            }

            if (outline == null)
            {
                return;
            }

            var itemCollection = parent?.Items ?? TreeView.Items;

            var item = new TreeViewItem {
                Header = new OutlineItemControl {
                    CrispImage =
                    {
                        Moniker = GdImageMonikers.GetMoniker(outline.Glyph)
                    },