• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NavigateToItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NavigateToItem的典型用法代码示例。如果您正苦于以下问题:C# NavigateToItem类的具体用法?C# NavigateToItem怎么用?C# NavigateToItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NavigateToItem类属于命名空间,在下文中一共展示了NavigateToItem类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PythonNavigateToItemDisplay

        public PythonNavigateToItemDisplay(NavigateToItem item) {
            _item = item;
            var tag = (PythonNavigateToItemProvider.ItemTag)item.Tag;
            _node = tag.Node;
            _icon = GetIcon(tag.GlyphService, _node.GlyphType);

            var descrItems = new List<DescriptionItem>();

            IVsHierarchy hier;
            uint itemId;
            uint itemsCount;
            _node.SourceItems(out hier, out itemId, out itemsCount);
            if (hier != null) {
                descrItems.Add(new DescriptionItem(
                    Array.AsReadOnly(new[] { new DescriptionRun("Project:", bold: true) }),
                    Array.AsReadOnly(new[] { new DescriptionRun(hier.GetProject().FullName) })));

                string fileName;
                hier.GetCanonicalName(itemId, out fileName);
                if (fileName != null) {
                    descrItems.Add(new DescriptionItem(
                        Array.AsReadOnly(new[] { new DescriptionRun("File:", bold: true) }),
                        Array.AsReadOnly(new[] { new DescriptionRun(fileName) })));

                    var commonNode = _node as CommonLibraryNode;
                    if (commonNode != null && commonNode.CanGoToSource) {
                        descrItems.Add(new DescriptionItem(
                            Array.AsReadOnly(new[] { new DescriptionRun("Line:", bold: true) }),
                            Array.AsReadOnly(new[] { new DescriptionRun((commonNode.SourceSpan.iStartLine + 1).ToString()) })));
                    }
                }
            }

            _descrItems = descrItems.AsReadOnly();
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:35,代码来源:PythonNavigateToItemDisplay.cs


示例2: VerifyNavigateToResultItem

        private void VerifyNavigateToResultItem(NavigateToItem result, string name, MatchKind matchKind, string navigateToItemKind,
           string displayName = null, string additionalInfo = null)
        {
            // Verify symbol information
            Assert.Equal(name, result.Name);
            Assert.Equal(matchKind, result.MatchKind);
            Assert.Equal("csharp", result.Language);
            Assert.Equal(navigateToItemKind, result.Kind);

            // Verify display
            var itemDisplay = result.DisplayFactory.CreateItemDisplay(result);

            Assert.Equal(displayName ?? name, itemDisplay.Name);

            if (additionalInfo != null)
            {
                Assert.Equal(additionalInfo, itemDisplay.AdditionalInformation);
            }

            // Make sure to fetch the glyph
            var unused = itemDisplay.Glyph;
            _glyphServiceMock.Verify();
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:23,代码来源:NavigateToTests.cs


示例3: TermSplittingTest3

        public void TermSplittingTest3()
        {
            var source = "class SyllableBreaking {int GetKeyWord; int get_key_word; string get_keyword; int getkeyword; int wake;}";
            using (var workspace = SetupWorkspace(source))
            {
                var expecteditem1 = new NavigateToItem("get_key_word", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Regular, null);
                var expecteditem2 = new NavigateToItem("GetKeyWord", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Substring, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem2 };

                var items = _aggregator.GetItems("K W");

                VerifyNavigateToResultItems(expecteditems, items);
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:14,代码来源:NavigateToTests.cs


示例4: FindOverriddenMembers

        public void FindOverriddenMembers()
        {
            var program = "class Foo { public virtual string Name { get; set; } } class DogBed : Foo { public override string Name { get { return base.Name; } set {} } }";
            using (var workspace = SetupWorkspace(program))
            {
                SetupVerifiableGlyph(StandardGlyphGroup.GlyphGroupProperty, StandardGlyphItem.GlyphItemPublic);
                var expecteditem1 = new NavigateToItem("Name", NavigateToItemKind.Property, "csharp", null, null, MatchKind.Exact, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem1 };

                var items = _aggregator.GetItems("Name");

                VerifyNavigateToResultItems(expecteditems, items);

                var item = items.ElementAt(0);
                var itemDisplay = item.DisplayFactory.CreateItemDisplay(item);
                var unused = itemDisplay.Glyph;

                Assert.Equal("Name", itemDisplay.Name);
                Assert.Equal($"{EditorFeaturesResources.Type}DogBed", itemDisplay.AdditionalInformation);
                _glyphServiceMock.Verify();

                item = items.ElementAt(1);
                itemDisplay = item.DisplayFactory.CreateItemDisplay(item);
                unused = itemDisplay.Glyph;

                Assert.Equal("Name", itemDisplay.Name);
                Assert.Equal($"{EditorFeaturesResources.Type}Foo", itemDisplay.AdditionalInformation);
                _glyphServiceMock.Verify();
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:30,代码来源:NavigateToTests.cs


示例5: FindPartialMethods

        public void FindPartialMethods()
        {
            using (var workspace = SetupWorkspace("partial class Foo { partial void Bar(); } partial class Foo { partial void Bar() { Console.Write(\"hello\"); } }"))
            {
                var expecteditem1 = new NavigateToItem("Bar", NavigateToItemKind.Method, "csharp", null, null, MatchKind.Exact, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem1 };

                var items = _aggregator.GetItems("Bar");

                VerifyNavigateToResultItems(expecteditems, items);
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:NavigateToTests.cs


示例6: FindPartialClass

        public void FindPartialClass()
        {
            using (var workspace = SetupWorkspace("public partial class Foo { int a; } partial class Foo { int b; }"))
            {
                var expecteditem1 = new NavigateToItem("Foo", NavigateToItemKind.Class, "csharp", null, null, MatchKind.Exact, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem1 };

                var items = _aggregator.GetItems("Foo");

                VerifyNavigateToResultItems(expecteditems, items);
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:NavigateToTests.cs


示例7: CreateItemDisplay

 public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
 {
     return new JNavigateToItemDisplay(item);
 }
开发者ID:borota,项目名称:JTVS,代码行数:4,代码来源:JNavigateToItemDisplayFactory.cs


示例8: CreateItemDisplay

 public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
 {
     return item.Tag as INavigateToItemDisplay;
 }
开发者ID:tgjones,项目名称:HlslTools,代码行数:4,代码来源:NavigateToItemProviderFactory.cs


示例9: FindPartialMethods

        public async Task FindPartialMethods()
        {
            await TestAsync("partial class Foo { partial void Bar(); } partial class Foo { partial void Bar() { Console.Write(\"hello\"); } }", async w =>
            {
                var expecteditem1 = new NavigateToItem("Bar", NavigateToItemKind.Method, "csharp", null, null, MatchKind.Exact, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem1 };

                var items = await _aggregator.GetItemsAsync("Bar");

                VerifyNavigateToResultItems(expecteditems, items);
            });
        }
开发者ID:genlu,项目名称:roslyn,代码行数:12,代码来源:NavigateToTests.cs


示例10: TermSplittingTest3

        public async Task TermSplittingTest3()
        {
            var source = "class SyllableBreaking {int GetKeyWord; int get_key_word; string get_keyword; int getkeyword; int wake;}";
            await TestAsync(source, async w =>
            {
                var expecteditem1 = new NavigateToItem("get_key_word", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Regular, null);
                var expecteditem2 = new NavigateToItem("GetKeyWord", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Substring, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem2 };

                var items = await _aggregator.GetItemsAsync("K W");

                VerifyNavigateToResultItems(expecteditems, items);
            });
        }
开发者ID:genlu,项目名称:roslyn,代码行数:14,代码来源:NavigateToTests.cs


示例11: FindPartialClass

        public async Task FindPartialClass()
        {
            await TestAsync("public partial class Foo { int a; } partial class Foo { int b; }", async w =>
            {
                var expecteditem1 = new NavigateToItem("Foo", NavigateToItemKind.Class, "csharp", null, null, MatchKind.Exact, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem1 };

                var items = await _aggregator.GetItemsAsync("Foo");

                VerifyNavigateToResultItems(expecteditems, items);
            });
        }
开发者ID:genlu,项目名称:roslyn,代码行数:12,代码来源:NavigateToTests.cs


示例12: CreateItemDisplay

 public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
 {
     var searchResult = (INavigateToSearchResult)item.Tag;
     return new NavigateToItemDisplay(searchResult, _iconFactory);
 }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:5,代码来源:NavigateToItemProvider.ItemDisplayFactory.cs


示例13: CreateItemDisplay

 public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
 {
     var searchResult = (INavigateToSearchResult)item.Tag;
     return new Dev15NavigateToItemDisplay(searchResult);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:5,代码来源:Dev15NavigateToHostVersionService.Dev15ItemDisplayFactory.cs


示例14: CompareNavigateToItems

        // For ordering of NavigateToItems, see
        // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.language.navigateto.interfaces.navigatetoitem.aspx
        private static int CompareNavigateToItems(NavigateToItem a, NavigateToItem b)
        {
            int result = ((int)a.MatchKind) - ((int)b.MatchKind);
            if (result != 0)
            {
                return result;
            }

            result = a.Name.CompareTo(b.Name);
            if (result != 0)
            {
                return result;
            }

            result = a.Kind.CompareTo(b.Kind);
            if (result != 0)
            {
                return result;
            }

            result = a.SecondarySort.CompareTo(b.SecondarySort);
            return result;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:25,代码来源:NavigateToTests.cs


示例15: TermSplittingTest1

        public async Task TermSplittingTest1()
        {
            var source = "class SyllableBreaking {int GetKeyWord; int get_key_word; string get_keyword; int getkeyword; int wake;}";
            using (var workspace = await SetupWorkspaceAsync(source))
            {
                var expecteditem1 = new NavigateToItem("get_keyword", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Regular, null);
                var expecteditem2 = new NavigateToItem("get_key_word", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Regular, null);
                var expecteditem3 = new NavigateToItem("GetKeyWord", NavigateToItemKind.Field, "csharp", null, null, MatchKind.Regular, true, null);
                var expecteditems = new List<NavigateToItem> { expecteditem1, expecteditem2, expecteditem3 };

                var items = _aggregator.GetItems("GK");

                Assert.Equal(expecteditems.Count(), items.Count());

                VerifyNavigateToResultItems(expecteditems, items);
            }
        }
开发者ID:natidea,项目名称:roslyn,代码行数:17,代码来源:InteractiveNavigateToTests.cs


示例16: ReportMatchResult

 private void ReportMatchResult(Project project, INavigateToSearchResult result)
 {
     var navigateToItem = new NavigateToItem(
         result.Name,
         result.Kind,
         GetNavigateToLanguage(project.Language),
         result.SecondarySort,
         result,
         result.MatchKind,
         result.IsCaseSensitive,
         _displayFactory);
     _callback.AddItem(navigateToItem);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:NavigateToItemProvider.Searcher.cs


示例17: AddItem

 public void AddItem(NavigateToItem item)
 {
     _itemsReceived.Add(item);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:NavigateToTestAggregator.Callback.cs



注:本文中的NavigateToItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NavigationData类代码示例发布时间:2022-05-24
下一篇:
C# NavObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap