From b1ba4006ee72c8900bcf37e24118934f5b694e2f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 5 Dec 2015 13:06:37 -0800 Subject: [PATCH] The desired name for an attribute in an attribute context should not have hte attribute suffix. --- .../AddImport/AbstractAddImportCodeFixProvider.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs index ae39afcf650..c6669693238 100644 --- a/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs @@ -474,8 +474,10 @@ private async Task> GetMatchingTypesAsync(SearchScope sea // also lookup type symbols with the "Attribute" suffix. if (inAttributeContext) { + var attributeSymbols = await searchScope.FindDeclarationsAsync(name + "Attribute", SymbolFilter.Type).ConfigureAwait(false); + symbols = symbols.Concat( - await searchScope.FindDeclarationsAsync(name + "Attribute", SymbolFilter.Type).ConfigureAwait(false)); + attributeSymbols.Select(r => r.WithDesiredName(r.DesiredName.GetWithoutAttributeSuffix(isCaseSensitive: false)))); } return OfType(symbols); @@ -749,6 +751,11 @@ public SearchResult(string desiredName, T symbol, double weight) { return new SearchResult(this.DesiredName, symbol, this.Weight); } + + internal SearchResult WithDesiredName(string desiredName) + { + return new SearchResult(desiredName, Symbol, Weight); + } } private struct SearchResult -- GitLab