roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Smart Rename: Provide additional context for renamed symbol

Open AmadeusW opened this issue 8 months ago • 2 comments

Provide references, definitions and documentation of renamed symbol in Smart Rename. The purpose is to improve quality of suggestions, and ultimately remove the need to provide the entire document.

The feature is gated behind a feature flag, visible to MSFT internal users: image

When feature flag is set, additional data is collected and attached to the prompt, for example:

Your task is to help a software developer improve the identifier name indicated by [NameThisIdentifier]. The existing identifier name is ShowMarkdownPreviewKey
Use the following information as context:

[BEGIN-DEFINITION]
        internal static readonly EditorOptionKey<bool> ShowMarkdownPreviewKey = new EditorOptionKey<bool>(ShowMarkdownPreviewOptionId);

[END-DEFINITION]

[BEGIN-REFERENCE]
        internal static bool GetDefaultShowMarkdownPreview(this ITextView textView)
        {
            return textView.Options.GlobalOptions.GetOptionValue(MarkdownOptions.ShowMarkdownPreviewKey);
        }

[END-REFERENCE]

[BEGIN-REFERENCE]
        internal static void SetPerViewShowMarkdownPreview(this ITextView textView, bool showPreview)
        {
            textView.Options.SetOptionValue(MarkdownOptions.ShowMarkdownPreviewKey, showPreview);
        }

[END-REFERENCE]

[BEGIN-REFERENCE]
        internal static bool GetPerViewShowMarkdownPreview(this ITextView textView)
        {
            return textView.Options.GetOptionValue(MarkdownOptions.ShowMarkdownPreviewKey);
        }

[END-REFERENCE]

[BEGIN-REFERENCE]
        internal static void SetDefaultShowMarkdownPreview(this ITextView textView, bool showPreview)
        {
            textView.Options.GlobalOptions.SetOptionValue(MarkdownOptions.ShowMarkdownPreviewKey, showPreview);
        }

[END-REFERENCE]

[BEGIN-REFERENCE]
            public override EditorOptionKey<bool> Key => ShowMarkdownPreviewKey;

[END-REFERENCE]

[BEGIN-DOCUMENTATION]
<member name="F:Microsoft.VisualStudio.Markdown.MarkdownOptions.ShowMarkdownPreviewKey">
    <summary>
    Whether Markdown preview should be visible.
    When set in <see cref="P:Microsoft.VisualStudio.Text.Editor.IEditorOptions.GlobalOptions" />, influences default behavior for newly opened views.
    A specific view may override this value in its <see cref="P:Microsoft.VisualStudio.Text.Editor.ITextView.Options" />.
    </summary>
</member>

[END-DOCUMENTATION]

AmadeusW avatar Jun 06 '24 17:06 AmadeusW