Skip to content

Commit

Permalink
Merge pull request #61183 from CyrusNajmabadi/pasteOrder
Browse files Browse the repository at this point in the history
Ensure we do string-copy-paste before format-on-paste
  • Loading branch information
CyrusNajmabadi authored May 9, 2022
2 parents 321b4d6 + 1d69a3f commit f124c09
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using VSUtilities = Microsoft.VisualStudio.Utilities;

Expand All @@ -43,8 +44,9 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.StringCopyPaste
/// doesn't want the change we made, they can always undo to get the prior paste behavior.
/// </remarks>
[Export(typeof(ICommandHandler))]
[VSUtilities.ContentType(ContentTypeNames.CSharpContentType)]
[VSUtilities.Name(nameof(StringCopyPasteCommandHandler))]
[ContentType(ContentTypeNames.CSharpContentType)]
[Name(PredefinedCommandHandlerNames.StringCopyPaste)]
[Order(After = PredefinedCommandHandlerNames.FormatDocument)]
internal partial class StringCopyPasteCommandHandler :
IChainedCommandHandler<CutCommandArgs>,
IChainedCommandHandler<CopyCommandArgs>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ internal static class PredefinedCommandHandlerNames
/// </summary>
public const string SignatureHelpAfterCompletion = "Signature Help After Completion Command Handler";

/// <summary>
/// Command handler name for String Copy Paste.
/// </summary>
public const string StringCopyPaste = "String Copy Paste";

/// <summary>
/// Command handler name for Toggle Block Comments.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/EditorFeatures/Core/Formatting/FormatCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace Microsoft.CodeAnalysis.Formatting
[ContentType(ContentTypeNames.RoslynContentType)]
[Name(PredefinedCommandHandlerNames.FormatDocument)]
[Order(After = PredefinedCommandHandlerNames.Rename)]
[Order(Before = PredefinedCommandHandlerNames.StringCopyPaste)]
[Order(Before = PredefinedCompletionNames.CompletionCommandHandler)]
internal partial class FormatCommandHandler :
ICommandHandler<FormatDocumentCommandArgs>,
Expand Down

0 comments on commit f124c09

Please sign in to comment.