提交 5d726543 编写于 作者: R Ravi Chande

Show a description when suggesting names

Fixes https://github.com/dotnet/roslyn/issues/19200
上级 3f35adf5
......@@ -3,6 +3,7 @@
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Completion.Providers;
using Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders;
......@@ -36,7 +37,7 @@ public class MyClass
MyClass $$
}
";
await VerifyItemExistsAsync(markup, "MyClass", glyph: (int)Glyph.MethodPublic);
await VerifyItemExistsAsync(markup, "MyClass", glyph: (int)Glyph.MethodPublic, expectedDescriptionOrNull: CSharpFeaturesResources.suggested_name);
await VerifyItemExistsAsync(markup, "myClass", glyph: (int)Glyph.FieldPublic);
await VerifyItemExistsAsync(markup, "GetMyClass", glyph: (int)Glyph.MethodPublic);
}
......
......@@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis.CSharp {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CSharpFeaturesResources {
......@@ -980,6 +980,15 @@ internal class CSharpFeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to (Suggested name).
/// </summary>
internal static string suggested_name {
get {
return ResourceManager.GetString("suggested_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The name &apos;{0}&apos; does not exist in the current context..
/// </summary>
......
......@@ -521,4 +521,7 @@
<data name="Autoselect_disabled_due_to_member_declaration" xml:space="preserve">
<value>Autoselect disabled due to member declaration</value>
</data>
<data name="suggested_name" xml:space="preserve">
<value>(Suggested name)</value>
</data>
</root>
\ No newline at end of file
......@@ -191,7 +191,12 @@ private ITypeSymbol UnwrapType(ITypeSymbol type, Compilation compilation)
CompletionItem CreateCompletionItem(string name, Glyph glyph, string sortText)
{
return CommonCompletionItem.Create(name, CompletionItemRules.Default, glyph: glyph, sortText: sortText);
return CommonCompletionItem.Create(
name,
CompletionItemRules.Default,
glyph: glyph,
sortText: sortText,
description: CSharpFeaturesResources.suggested_name.ToSymbolDisplayParts());
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册