提交 2e31f3e0 编写于 作者: D David Poeschl

Commit rename on more editing cmds and refactorings

Fixes internal bugs 991517 and 1142701

Commit rename on the following commands:

- Cut/Paste, if the operation occurs outside a rename span
- MoveSelectedLines
- Command-based refactorings (Change Signature, Extract Interface, and
Encapsulate Field)
上级 72bd2073
......@@ -8,8 +8,7 @@
namespace Microsoft.CodeAnalysis.Editor.CSharp.EncapsulateField
{
[ExportCommandHandler("EncapsulateField",
ContentTypeNames.CSharpContentType)]
[ExportCommandHandler(PredefinedCommandHandlerNames.EncapsulateField, ContentTypeNames.CSharpContentType)]
[Order(After = PredefinedCommandHandlerNames.DocumentationComments)]
internal class EncapsulateFieldCommandHandler : AbstractEncapsulateFieldCommandHandler
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Commands
{
/// <summary>
/// Arguments for move selected lines down command
/// </summary>
[ExcludeFromCodeCoverage]
internal class MoveSelectedLinesDownCommandArgs : CommandArgs
{
public MoveSelectedLinesDownCommandArgs(ITextView textView, ITextBuffer subjectBuffer)
: base(textView, subjectBuffer)
{
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Commands
{
/// <summary>
/// Arguments for move selected lines up command
/// </summary>
[ExcludeFromCodeCoverage]
internal class MoveSelectedLinesUpCommandArgs : CommandArgs
{
public MoveSelectedLinesUpCommandArgs(ITextView textView, ITextBuffer subjectBuffer)
: base(textView, subjectBuffer)
{
}
}
}
......@@ -144,6 +144,8 @@
<Compile Include="CommandHandlers\QuickInfoCommandHandlerAndSourceProvider.cs" />
<Compile Include="CommandHandlers\QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs" />
<Compile Include="CommandHandlers\SignatureHelpCommandHandler.cs" />
<Compile Include="Commands\MoveSelectedLinesDownCommandArgs.cs" />
<Compile Include="Commands\MoveSelectedLinesUpCommandArgs.cs" />
<Compile Include="Commands\AutomaticLineEnderCommandArgs.cs" />
<Compile Include="Commands\BackspaceKeyCommandArgs.cs" />
<Compile Include="Commands\BackTabKeyCommandArgs.cs" />
......@@ -401,6 +403,8 @@
<Compile Include="Implementation\InlineRename\AbstractInlineRenameUndoManager.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_BackspaceDeleteHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_RefactoringWithCommandHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_MoveSelectedLinesHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_EscapeHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_LineStartEndHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_OpenLineBelowHandler.cs" />
......@@ -410,6 +414,7 @@
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_SaveHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_TabHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_OpenLineAboveHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_CutPasteHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_TypeCharHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_UndoRedoHandler.cs" />
<Compile Include="Implementation\InlineRename\CommandHandlers\RenameCommandHandler_WordDeleteHandler.cs" />
......
......@@ -47,6 +47,11 @@ internal static class PredefinedCommandHandlerNames
/// </summary>
public const string DocumentationComments = "Documentation Comments Command Handler";
/// <summary>
/// Command handler name for Encapsulate Field.
/// </summary>
public const string EncapsulateField = "EncapsulateField";
/// <summary>
/// Command handler name for End Construct.
/// </summary>
......
......@@ -6,6 +6,7 @@
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Utilities;
......@@ -14,6 +15,10 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
// Line commit and rename are both executed on Save. Ensure any rename session is committed
// before line commit runs to ensure changes from both are correctly applied.
[Order(Before = PredefinedCommandHandlerNames.Commit)]
// Commit rename before invoking command-based refactorings
[Order(Before = PredefinedCommandHandlerNames.ChangeSignature)]
[Order(Before = PredefinedCommandHandlerNames.ExtractInterface)]
[Order(Before = PredefinedCommandHandlerNames.EncapsulateField)]
[ExportCommandHandler(PredefinedCommandHandlerNames.Rename, ContentTypeNames.RoslynContentType)]
internal partial class RenameCommandHandler
{
......@@ -69,18 +74,27 @@ private void HandlePossibleTypingCommand(CommandArgs args, Action nextHandler, A
}
else
{
var selection = args.TextView.Selection.VirtualSelectedSpans.First();
// It's in a read-only area, so let's commit the rename and then let the character go
// through
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
}
private void CommitIfActiveAndCallNextHandler(CommandArgs args, Action nextHandler)
{
if (_renameService.ActiveSession != null)
{
var selection = args.TextView.Selection.VirtualSelectedSpans.First();
_renameService.ActiveSession.Commit();
var translatedSelection = selection.TranslateTo(args.TextView.TextBuffer.CurrentSnapshot);
args.TextView.Selection.Select(translatedSelection.Start, translatedSelection.End);
args.TextView.Caret.MoveTo(translatedSelection.End);
nextHandler();
}
nextHandler();
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Editor.Commands;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
internal partial class RenameCommandHandler :
ICommandHandler<CutCommandArgs>, ICommandHandler<PasteCommandArgs>
{
public CommandState GetCommandState(CutCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(CutCommandArgs args, Action nextHandler)
{
HandlePossibleTypingCommand(args, nextHandler, span =>
{
nextHandler();
});
}
public CommandState GetCommandState(PasteCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(PasteCommandArgs args, Action nextHandler)
{
HandlePossibleTypingCommand(args, nextHandler, span =>
{
nextHandler();
});
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Editor.Commands;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
internal partial class RenameCommandHandler :
ICommandHandler<MoveSelectedLinesUpCommandArgs>, ICommandHandler<MoveSelectedLinesDownCommandArgs>
{
public CommandState GetCommandState(MoveSelectedLinesUpCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(MoveSelectedLinesUpCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
public CommandState GetCommandState(MoveSelectedLinesDownCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(MoveSelectedLinesDownCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Editor.Commands;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
internal partial class RenameCommandHandler :
ICommandHandler<ReorderParametersCommandArgs>,
ICommandHandler<RemoveParametersCommandArgs>,
ICommandHandler<ExtractInterfaceCommandArgs>,
ICommandHandler<EncapsulateFieldCommandArgs>
{
public CommandState GetCommandState(ReorderParametersCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(ReorderParametersCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
public CommandState GetCommandState(RemoveParametersCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(RemoveParametersCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
public CommandState GetCommandState(ExtractInterfaceCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(ExtractInterfaceCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
public CommandState GetCommandState(EncapsulateFieldCommandArgs args, Func<CommandState> nextHandler)
{
return nextHandler();
}
public void ExecuteCommand(EncapsulateFieldCommandArgs args, Action nextHandler)
{
CommitIfActiveAndCallNextHandler(args, nextHandler);
}
}
}
......@@ -8,6 +8,7 @@ Imports Microsoft.CodeAnalysis.Editor.Shared.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Text.Shared.Extensions
Imports Microsoft.VisualStudio.Text
Imports Microsoft.VisualStudio.Text.Editor
Imports Microsoft.VisualStudio.Text.Operations
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
......@@ -1033,5 +1034,228 @@ partial class [|Program|]
Assert.Null(workspace.GetService(Of IInlineRenameService).ActiveSession)
End Using
End Sub
<Fact>
<WorkItem(1142701)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub MoveSelectedLinesUpDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New MoveSelectedLinesUpCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<WorkItem(1142701)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub MoveSelectedLinesDownDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New MoveSelectedLinesDownCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<WorkItem(991517)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub ReorderParametersDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New ReorderParametersCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<WorkItem(991517)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub RemoveParametersDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New RemoveParametersCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<WorkItem(991517)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub ExtractInterfaceDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New ExtractInterfaceCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<WorkItem(991517)>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub EncapsulateFieldDuringRename()
VerifyCommandCommitsRenameSessionAndExecutesCommand(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New EncapsulateFieldCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub CutDuringRename_InsideIdentifier()
VerifySessionActiveAfterCutPasteInsideIdentifier(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New CutCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub PasteDuringRename_InsideIdentifier()
VerifySessionActiveAfterCutPasteInsideIdentifier(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New PasteCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub CutDuringRename_OutsideIdentifier()
VerifySessionCommittedAfterCutPasteOutsideIdentifier(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New CutCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
<Fact>
<Trait(Traits.Feature, Traits.Features.Rename)>
Public Sub PasteDuringRename_OutsideIdentifier()
VerifySessionCommittedAfterCutPasteOutsideIdentifier(
Sub(commandHandler As RenameCommandHandler, view As IWpfTextView, nextHandler As Action)
commandHandler.ExecuteCommand(New PasteCommandArgs(view, view.TextBuffer), nextHandler)
End Sub)
End Sub
Private Sub VerifyCommandCommitsRenameSessionAndExecutesCommand(executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action))
Using workspace = CreateWorkspaceWithWaiter(
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
// Comment
class [|C$$|]
{
[|C|] f;
}
</Document>
</Project>
</Workspace>)
Dim view = workspace.Documents.Single().GetTextView()
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
renameService,
workspace.GetService(Of IEditorOperationsFactoryService),
workspace.GetService(Of IWaitIndicator))
Dim session = StartSession(workspace)
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
' Type first in the main identifier
view.Selection.Clear()
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
commandHandler.ExecuteCommand(New TypeCharCommandArgs(view, view.TextBuffer, "D"c), Sub() editorOperations.InsertText("D"))
' Then execute the command
Dim commandInvokedString = "/*Command Invoked*/"
executeCommand(commandHandler, view, Sub() editorOperations.InsertText(commandInvokedString))
' Verify rename session was committed.
Assert.Null(workspace.GetService(Of IInlineRenameService).ActiveSession)
Assert.Contains("D f", view.TextBuffer.CurrentSnapshot.GetText())
' Verify the command was routed to the editor.
Assert.Contains(commandInvokedString, view.TextBuffer.CurrentSnapshot.GetText())
End Using
End Sub
Private Sub VerifySessionActiveAfterCutPasteInsideIdentifier(executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action))
Using workspace = CreateWorkspaceWithWaiter(
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
// Comment
class [|C$$|]
{
[|C|] f;
}
</Document>
</Project>
</Workspace>)
Dim view = workspace.Documents.Single().GetTextView()
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
renameService,
workspace.GetService(Of IEditorOperationsFactoryService),
workspace.GetService(Of IWaitIndicator))
Dim session = StartSession(workspace)
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
' Then execute the command
Dim commandInvokedString = "commandInvoked"
executeCommand(commandHandler, view, Sub() editorOperations.InsertText(commandInvokedString))
' Verify rename session is still active
Assert.NotNull(workspace.GetService(Of IInlineRenameService).ActiveSession)
VerifyTagsAreCorrect(workspace, commandInvokedString)
End Using
End Sub
Private Sub VerifySessionCommittedAfterCutPasteOutsideIdentifier(executeCommand As Action(Of RenameCommandHandler, IWpfTextView, Action))
Using workspace = CreateWorkspaceWithWaiter(
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
// Comment
class [|C$$|]
{
[|C|] f;
}
</Document>
</Project>
</Workspace>)
Dim view = workspace.Documents.Single().GetTextView()
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim commandHandler As New RenameCommandHandler(
renameService,
workspace.GetService(Of IEditorOperationsFactoryService),
workspace.GetService(Of IWaitIndicator))
Dim session = StartSession(workspace)
Dim editorOperations = workspace.GetService(Of IEditorOperationsFactoryService)().GetEditorOperations(view)
' Type first in the main identifier
view.Selection.Clear()
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value))
commandHandler.ExecuteCommand(New TypeCharCommandArgs(view, view.TextBuffer, "D"c), Sub() editorOperations.InsertText("D"))
' Then execute the command
Dim commandInvokedString = "commandInvoked"
Dim selectionStart = workspace.Documents.Single(Function(d) d.CursorPosition.HasValue).CursorPosition.Value - 6
view.Caret.MoveTo(New SnapshotPoint(view.TextBuffer.CurrentSnapshot, selectionStart))
view.SetSelection(New SnapshotSpan(view.TextBuffer.CurrentSnapshot, New Span(selectionStart, 2)))
executeCommand(commandHandler, view, Sub() editorOperations.InsertText(commandInvokedString))
' Verify rename session was committed
Assert.Null(workspace.GetService(Of IInlineRenameService).ActiveSession)
Assert.Contains("D f", view.TextBuffer.CurrentSnapshot.GetText())
Assert.Contains(commandInvokedString, view.TextBuffer.CurrentSnapshot.GetText())
End Using
End Sub
End Class
End Namespace
......@@ -7,7 +7,7 @@ Imports Microsoft.VisualStudio.Text.Operations
Imports Microsoft.VisualStudio.Utilities
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EncapsulateField
<ExportCommandHandler("EncapsulateField", ContentTypeNames.VisualBasicContentType)>
<ExportCommandHandler(PredefinedCommandHandlerNames.EncapsulateField, ContentTypeNames.VisualBasicContentType)>
<Order(After:=PredefinedCommandHandlerNames.DocumentationComments)>
Friend Class EncapsulateFieldCommandHandler
Inherits AbstractEncapsulateFieldCommandHandler
......
......@@ -66,6 +66,10 @@ public virtual int Exec(ref Guid pguidCmdGroup, uint commandId, uint executeInfo
{
return ExecuteAppCommand(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType);
}
else if (pguidCmdGroup == VSConstants.VsStd12)
{
return ExecuteVisualStudio2013(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut, subjectBuffer, contentType);
}
else
{
return NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut);
......@@ -125,6 +129,32 @@ private int ExecuteVisualStudio2014(ref Guid pguidCmdGroup, uint commandId, uint
return result;
}
private int ExecuteVisualStudio2013(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType)
{
int result = VSConstants.S_OK;
var guidCmdGroup = pguidCmdGroup;
Action executeNextCommandTarget = () =>
{
result = NextCommandTarget.Exec(ref guidCmdGroup, commandId, executeInformation, pvaIn, pvaOut);
};
switch ((VSConstants.VSStd12CmdID)commandId)
{
case VSConstants.VSStd12CmdID.MoveSelLinesDown:
ExecuteMoveSelectedLinesDown(subjectBuffer, contentType, executeNextCommandTarget);
break;
case VSConstants.VSStd12CmdID.MoveSelLinesUp:
ExecuteMoveSelectedLinesUp(subjectBuffer, contentType, executeNextCommandTarget);
break;
default:
return NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut);
}
return result;
}
private int ExecuteVisualStudio97(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType)
{
int result = VSConstants.S_OK;
......@@ -522,6 +552,20 @@ private int ExecuteInteractiveCommands(ref Guid pguidCmdGroup, uint commandId, u
return result;
}
#endif
private void ExecuteMoveSelectedLinesUp(ITextBuffer subjectBuffer, IContentType contentType, Action executeNextCommandTarget)
{
CurrentHandlers.Execute<MoveSelectedLinesUpCommandArgs>(contentType,
args: new MoveSelectedLinesUpCommandArgs(ConvertTextView(), subjectBuffer),
lastHandler: executeNextCommandTarget);
}
private void ExecuteMoveSelectedLinesDown(ITextBuffer subjectBuffer, IContentType contentType, Action executeNextCommandTarget)
{
CurrentHandlers.Execute<MoveSelectedLinesDownCommandArgs>(contentType,
args: new MoveSelectedLinesDownCommandArgs(ConvertTextView(), subjectBuffer),
lastHandler: executeNextCommandTarget);
}
private void ExecuteAutomaticLineEnder(ITextBuffer subjectBuffer, IContentType contentType, Action executeNextCommandTarget)
{
CurrentHandlers.Execute<AutomaticLineEnderCommandArgs>(contentType,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册