From 33f3458ded51cd250402831cd7501bb4b940d293 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 11 Apr 2016 14:13:31 -0700 Subject: [PATCH] You should be able to navigate to items that are in generated code. --- .../CSharpTest/NavigateTo/NavigateToTests.cs | 8 +++++--- .../Core/Extensibility/Navigation/NavigableItemFactory.cs | 3 ++- .../Implementation/NavigateTo/NavigateToSymbolFinder.cs | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs b/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs index 7dc9347d2cc..1cff975d4e9 100644 --- a/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs +++ b/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs @@ -840,8 +840,9 @@ public async Task DottedPattern7() } [WorkItem(1174255, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174255")] + [WorkItem(8009, "https://github.com/dotnet/roslyn/issues/8009")] [Fact, Trait(Traits.Feature, Traits.Features.NavigateTo)] - public async Task NoNavigationToGeneratedFiles() + public async Task NavigateToGeneratedFiles() { using (var workspace = await TestWorkspace.CreateAsync(@" @@ -860,7 +861,7 @@ namespace N { public partial class C { - public void VisibleMethod_Not() { } + public void VisibleMethod_Generated() { } } } @@ -876,7 +877,8 @@ public partial class C var items = _aggregator.GetItems("VisibleMethod"); var expectedItems = new List() { - new NavigateToItem("VisibleMethod", NavigateToItemKind.Method, "csharp", null, null, MatchKind.Exact, true, null) + new NavigateToItem("VisibleMethod", NavigateToItemKind.Method, "csharp", null, null, MatchKind.Exact, true, null), + new NavigateToItem("VisibleMethod_Generated", NavigateToItemKind.Method, "csharp", null, null, MatchKind.Prefix, true, null) }; // The pattern matcher should match 'VisibleMethod' to both 'VisibleMethod' and 'VisibleMethod_Not', except that diff --git a/src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs b/src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs index 4cbcbd3a616..4c3c46ec32a 100644 --- a/src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs +++ b/src/EditorFeatures/Core/Extensibility/Navigation/NavigableItemFactory.cs @@ -29,7 +29,8 @@ public static IEnumerable GetItemsFromPreferredSourceLocations(S return locations.Select(loc => GetItemFromSymbolLocation(solution, symbol, loc, displayString)); } - public static IEnumerable GetPreferredSourceLocations(Solution solution, ISymbol symbol) + public static IEnumerable GetPreferredSourceLocations( + Solution solution, ISymbol symbol) { // Prefer non-generated source locations over generated ones. diff --git a/src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSymbolFinder.cs b/src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSymbolFinder.cs index d71095beb23..1353a51307a 100644 --- a/src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSymbolFinder.cs +++ b/src/EditorFeatures/Core/Implementation/NavigateTo/NavigateToSymbolFinder.cs @@ -16,11 +16,10 @@ internal static class NavigateToSymbolFinder { internal static async Task>>> FindNavigableDeclaredSymbolInfos(Project project, string pattern, CancellationToken cancellationToken) { - var generatedCodeRecognitionService = project.LanguageServices.WorkspaceServices.GetService(); var patternMatcher = new PatternMatcher(pattern); var result = new List>>(); - foreach (var document in project.Documents.Where(d => !generatedCodeRecognitionService?.IsGeneratedCode(d) ?? true)) + foreach (var document in project.Documents) { cancellationToken.ThrowIfCancellationRequested(); var declaredSymbolInfos = await document.GetDeclaredSymbolInfosAsync(cancellationToken).ConfigureAwait(false); -- GitLab