-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Labels
Area-IDEConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature Request
Milestone
Description
I want to create a code action in my CodeFixProvider which causes particular text to be selected in the editor. Is this possible?
Note: this is not a rename operation, and not on a symbol, so adding a RenameAnnotation to the node does not work.
The proposal would be to add a SelectionAnnotation, which is used similar to RenameAnnotation but instead of triggering a rename operation it just sets the text selection.
namespace Microsoft.CodeAnalysis.CodeActions
{
/// <summary>
/// Apply this annotation to an appropriate SyntaxNode to request that it should be selected in the IDE after
/// the action.
/// </summary>
public static class SelectionAnnotation
{
public const string Kind = "CodeAction_Selection";
public static SyntaxAnnotation Create();
/// <summary>
/// Creates a selection annotation which selects a subspan within a syntax node to which the annotation is
/// applied. The index is calculated relative to the start of the <see cref="SyntaxNode.FullSpan"/> of the
/// syntax node.
/// </summary>
public static SyntaxAnnotation Create(int index, int length);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-IDEConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature Request