本文整理汇总了C#中NavigateToItem类的典型用法代码示例。如果您正苦于以下问题:C# NavigateToItem类的具体用法?C# NavigateToItem怎么用?C# NavigateToItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NavigateToItem类属于命名空间,在下文中一共展示了NavigateToItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例7: CreateItemDisplay
public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
{
return new JNavigateToItemDisplay(item);
}
示例8: CreateItemDisplay
public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
{
return item.Tag as INavigateToItemDisplay;
}
示例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);
});
}
示例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);
});
}
示例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);
});
}
示例12: CreateItemDisplay
public INavigateToItemDisplay CreateItemDisplay(NavigateToItem item)
{
var searchResult = (INavigateToSearchResult)item.Tag;
return new NavigateToItemDisplay(searchResult, _iconFactory);
}
示例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;
}
示例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);
}
}