diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-03-23 01:28:58 +0300 |
---|---|---|
committer | Aaron Bockover <abock@microsoft.com> | 2019-04-01 20:06:52 +0300 |
commit | 0c7d77be28c9e2c204de9d3b60ebb9c79cfc7988 (patch) | |
tree | f525873b6a68ef826e9c586c8e703d18ff531483 /src/Editor/Text/Def/TextUI/Commanding | |
parent | 6f37e7f7eb79a9df8ebed2223fa7bf286c8cc866 (diff) |
Mirror the src/Editor folder structure from VS-Platform
Diffstat (limited to 'src/Editor/Text/Def/TextUI/Commanding')
76 files changed, 1037 insertions, 0 deletions
diff --git a/src/Editor/Text/Def/TextUI/Commanding/CommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/CommandArgs.cs new file mode 100644 index 0000000..ea4b4e2 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/CommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Commanding +{ + /// <summary> + /// A base class for all command arguments. + /// </summary> + public abstract class CommandArgs + { + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/CommandExecutionContext.cs b/src/Editor/Text/Def/TextUI/Commanding/CommandExecutionContext.cs new file mode 100644 index 0000000..f39cd55 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/CommandExecutionContext.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.VisualStudio.Utilities; + +namespace Microsoft.VisualStudio.Commanding +{ + /// <summary> + /// Represents a command execution context, which is set up by a command handler service + /// and provided to each command handler. + /// </summary> + public sealed class CommandExecutionContext + { + /// <summary> + /// Creates new instance of the <see cref="CommandExecutionContext"/>. + /// </summary> + public CommandExecutionContext(IUIThreadOperationContext waitContext) + { + this.WaitContext = waitContext ?? throw new ArgumentNullException(nameof(waitContext)); + } + + /// <summary> + /// Provides a context of executing a command handler on the UI thread, which + /// enables two way shared cancellability and wait indication. + /// </summary> + public IUIThreadOperationContext WaitContext { get; } + } +} + diff --git a/src/Editor/Text/Def/TextUI/Commanding/CommandHandlerExtensions.cs b/src/Editor/Text/Def/TextUI/Commanding/CommandHandlerExtensions.cs new file mode 100644 index 0000000..a4afd58 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/CommandHandlerExtensions.cs @@ -0,0 +1,123 @@ +using System; + +namespace Microsoft.VisualStudio.Commanding +{ + /// <summary> + /// Contains command handler utility extension methods. + /// </summary> + public static class CommandHandlerExtensions + { + /// <summary> + /// Called to determine the state of the command. + /// </summary> + /// <remarks> + /// <para> + /// A command handler can implement <see cref="ICommandHandler{T}"/> or + /// <see cref="IChainedCommandHandler{T}"/>, but either way this method returns + /// the final state of the command as returned by either this or next + /// command handler. + /// </para> + /// <para>If <paramref name="commandHandler"/> implements <see cref="ICommandHandler{T}"/>, + /// its <see cref="ICommandHandler{T}.GetCommandState(T)"/> method is called. If it returns + /// <see cref="CommandState.Unspecified"/>, <paramref name="nextCommandHandler"/> is invoked. + ///</para> + ///<para> + /// If <paramref name="commandHandler"/> implements <see cref="IChainedCommandHandler{T}"/>, + /// its <see cref="IChainedCommandHandler{T}.GetCommandState(T, Func{CommandState})"/> method is invoked with + /// <paramref name="nextCommandHandler"/> passed as an argument. + ///</para> + /// </remarks> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <param name="nextCommandHandler">The next command handler in the command execution chain.</param> + /// <param name="commandHandler">A command handler to query the state of the command.</param> + /// <returns>A <see cref="CommandState"/> instance that contains information on the availability of the command.</returns> + public static CommandState GetCommandState<T>(this ICommandHandler commandHandler, T args, Func<CommandState> nextCommandHandler) where T : CommandArgs + { + if (commandHandler == null) + { + throw new ArgumentNullException(nameof(commandHandler)); + } + + if (nextCommandHandler == null) + { + throw new ArgumentNullException(nameof(nextCommandHandler)); + } + + if (commandHandler is ICommandHandler<T> simpleCommandHandler) + { + var commandState = simpleCommandHandler.GetCommandState(args); + if (commandState.IsUnspecified) + { + return nextCommandHandler(); + } + + return commandState; + } + + if (commandHandler is IChainedCommandHandler<T> chainedCommandHandler) + { + return chainedCommandHandler.GetCommandState(args, nextCommandHandler); + } + + throw new ArgumentException($"Unsupported CommandHandler type: {commandHandler.GetType()}"); + } + + /// <summary> + /// Called to execute the command. + /// </summary> + /// <remarks> + /// <para> + /// A command handler can implement <see cref="ICommandHandler{T}"/> or + /// <see cref="IChainedCommandHandler{T}"/>, but either way this method executes + /// the command by either this or next command handler. + /// </para> + /// <para>If <paramref name="commandHandler"/> implements <see cref="ICommandHandler{T}"/>, + /// its <see cref="ICommandHandler{T}.ExecuteCommand(T, CommandExecutionContext)"/> method is called. If it returns + /// <c>false</c>, <paramref name="nextCommandHandler"/> is invoked. + ///</para> + ///<para> + /// If <paramref name="commandHandler"/> implements <see cref="IChainedCommandHandler{T}"/>, + /// its <see cref="IChainedCommandHandler{T}.ExecuteCommand(T, Action, CommandExecutionContext)"/> method is invoked with + /// <paramref name="nextCommandHandler"/> passed as an argument. + ///</para> + /// </remarks> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <param name="nextCommandHandler">The next command handler in the command execution chain.</param> + /// <param name="commandHandler">A command handler to execute the command.</param> + /// <param name="executionContext">Current command execution context.</param> + public static void ExecuteCommand<T>(this ICommandHandler commandHandler, T args, Action nextCommandHandler, CommandExecutionContext executionContext) where T : CommandArgs + { + if (commandHandler == null) + { + throw new ArgumentNullException(nameof(commandHandler)); + } + + if (nextCommandHandler == null) + { + throw new ArgumentNullException(nameof(nextCommandHandler)); + } + + if (commandHandler is ICommandHandler<T> simpleCommandHandler) + { + if (simpleCommandHandler.ExecuteCommand(args, executionContext)) + { + return; + } + else + { + nextCommandHandler(); + return; + } + } + + if (commandHandler is IChainedCommandHandler<T> chainedCommandHandler) + { + chainedCommandHandler.ExecuteCommand(args, nextCommandHandler, executionContext); + return; + } + + throw new ArgumentException($"Unsupported CommandHandler type: {commandHandler.GetType()}"); + } + } +} + diff --git a/src/Editor/Text/Def/TextUI/Commanding/CommandState.cs b/src/Editor/Text/Def/TextUI/Commanding/CommandState.cs new file mode 100644 index 0000000..93680c1 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/CommandState.cs @@ -0,0 +1,55 @@ +using System; + +namespace Microsoft.VisualStudio.Commanding +{ + public struct CommandState + { + /// <summary> + /// If true, the command state is unspecified and should not be taken into account. + /// </summary> + public bool IsUnspecified { get; } + + /// <summary> + /// If true, the command should be visible and enabled in the UI. + /// </summary> + public bool IsAvailable { get; } + + /// <summary> + /// If true, the command should appear as checked (i.e. toggled) in the UI. + /// </summary> + public bool IsChecked { get; } + + /// <summary> + /// If specified, returns the custom text that should be displayed in the UI. + /// </summary> + public string DisplayText { get; } + + public CommandState(bool isAvailable = false, bool isChecked = false, string displayText = null, bool isUnspecified = false) + { + if (isUnspecified && (isAvailable || isChecked || displayText != null)) + { + throw new ArgumentException("Unspecified command state cannot be combined with other states or command text."); + } + + this.IsAvailable = isAvailable; + this.IsChecked = isChecked; + this.IsUnspecified = isUnspecified; + this.DisplayText = displayText; + } + + /// <summary> + /// A helper singleton representing an available command state. + /// </summary> + public static CommandState Available { get; } = new CommandState(isAvailable: true); + + /// <summary> + /// A helper singleton representing an unavailable command state. + /// </summary> + public static CommandState Unavailable { get; } = new CommandState(isAvailable: false); + + /// <summary> + /// A helper singleton representing an unspecified command state. + /// </summary> + public static CommandState Unspecified { get; } = new CommandState(isUnspecified: true); + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/AutomaticLineEnderCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/AutomaticLineEnderCommandArgs.cs new file mode 100644 index 0000000..dca0d0c --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/AutomaticLineEnderCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class AutomaticLineEnderCommandArgs : EditorCommandArgs + { + public AutomaticLineEnderCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/BackTabKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/BackTabKeyCommandArgs.cs new file mode 100644 index 0000000..eeea83d --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/BackTabKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class BackTabKeyCommandArgs : EditorCommandArgs + { + public BackTabKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/BackspaceKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/BackspaceKeyCommandArgs.cs new file mode 100644 index 0000000..5808047 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/BackspaceKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class BackspaceKeyCommandArgs : EditorCommandArgs + { + public BackspaceKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/CommentSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/CommentSelectionCommandArgs.cs new file mode 100644 index 0000000..5072200 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/CommentSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class CommentSelectionCommandArgs : EditorCommandArgs + { + public CommentSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/CommitUniqueCompletionListItemCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/CommitUniqueCompletionListItemCommandArgs.cs new file mode 100644 index 0000000..48c34f5 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/CommitUniqueCompletionListItemCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class CommitUniqueCompletionListItemCommandArgs : EditorCommandArgs + { + public CommitUniqueCompletionListItemCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ContractSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ContractSelectionCommandArgs.cs new file mode 100644 index 0000000..038e9e3 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ContractSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ContractSelectionCommandArgs: EditorCommandArgs + { + public ContractSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyCommandArgs.cs new file mode 100644 index 0000000..47037f1 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class CopyCommandArgs : EditorCommandArgs + { + public CopyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyToInteractiveCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyToInteractiveCommandArgs.cs new file mode 100644 index 0000000..4351246 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/CopyToInteractiveCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class CopyToInteractiveCommandArgs : EditorCommandArgs + { + public CopyToInteractiveCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/CutCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/CutCommandArgs.cs new file mode 100644 index 0000000..fb60598 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/CutCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class CutCommandArgs : EditorCommandArgs + { + public CutCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/DeleteKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/DeleteKeyCommandArgs.cs new file mode 100644 index 0000000..434ab6f --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/DeleteKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class DeleteKeyCommandArgs : EditorCommandArgs + { + public DeleteKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentEndCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentEndCommandArgs.cs new file mode 100644 index 0000000..657e6ae --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentEndCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class DocumentEndCommandArgs : EditorCommandArgs + { + public DocumentEndCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentStartCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentStartCommandArgs.cs new file mode 100644 index 0000000..b8bc5d4 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/DocumentStartCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class DocumentStartCommandArgs : EditorCommandArgs + { + public DocumentStartCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/DownKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/DownKeyCommandArgs.cs new file mode 100644 index 0000000..7f2ed81 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/DownKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class DownKeyCommandArgs : EditorCommandArgs + { + public DownKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/DuplicateSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/DuplicateSelectionCommandArgs.cs new file mode 100644 index 0000000..12b6628 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/DuplicateSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class DuplicateSelectionCommandArgs: EditorCommandArgs + { + public DuplicateSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/EncapsulateFieldCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/EncapsulateFieldCommandArgs.cs new file mode 100644 index 0000000..13786b1 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/EncapsulateFieldCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class EncapsulateFieldCommandArgs : EditorCommandArgs + { + public EncapsulateFieldCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/EscapeKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/EscapeKeyCommandArgs.cs new file mode 100644 index 0000000..7f7e30c --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/EscapeKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class EscapeKeyCommandArgs : EditorCommandArgs + { + public EscapeKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ExecuteInInteractiveCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExecuteInInteractiveCommandArgs.cs new file mode 100644 index 0000000..8ea34f7 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExecuteInInteractiveCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ExecuteInInteractiveCommandArgs : EditorCommandArgs + { + public ExecuteInInteractiveCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ExpandSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExpandSelectionCommandArgs.cs new file mode 100644 index 0000000..7526f19 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExpandSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ExpandSelectionCommandArgs: EditorCommandArgs + { + public ExpandSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractInterfaceCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractInterfaceCommandArgs.cs new file mode 100644 index 0000000..0c48f8f --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractInterfaceCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ExtractInterfaceCommandArgs : EditorCommandArgs + { + public ExtractInterfaceCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractMethodCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractMethodCommandArgs.cs new file mode 100644 index 0000000..3e8694f --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ExtractMethodCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ExtractMethodCommandArgs : EditorCommandArgs + { + public ExtractMethodCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/FindReferencesCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/FindReferencesCommandArgs.cs new file mode 100644 index 0000000..32aadd1 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/FindReferencesCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class FindReferencesCommandArgs : EditorCommandArgs + { + public FindReferencesCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatDocumentCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatDocumentCommandArgs.cs new file mode 100644 index 0000000..7ba8eeb --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatDocumentCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class FormatDocumentCommandArgs : EditorCommandArgs + { + public FormatDocumentCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatSelectionCommandArgs.cs new file mode 100644 index 0000000..57f821e --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/FormatSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class FormatSelectionCommandArgs : EditorCommandArgs + { + public FormatSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToDefinitionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToDefinitionCommandArgs.cs new file mode 100644 index 0000000..e5df4e9 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToDefinitionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class GoToDefinitionCommandArgs : EditorCommandArgs + { + public GoToDefinitionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToNextMemberCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToNextMemberCommandArgs.cs new file mode 100644 index 0000000..8f74c77 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToNextMemberCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class GoToNextMemberCommandArgs : EditorCommandArgs + { + public GoToNextMemberCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToPreviousMemberCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToPreviousMemberCommandArgs.cs new file mode 100644 index 0000000..af8d3c8 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/GoToPreviousMemberCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class GoToPreviousMemberCommandArgs : EditorCommandArgs + { + public GoToPreviousMemberCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertCommentCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertCommentCommandArgs.cs new file mode 100644 index 0000000..e7e3bd3 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertCommentCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class InsertCommentCommandArgs : EditorCommandArgs + { + public InsertCommentCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertSnippetCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertSnippetCommandArgs.cs new file mode 100644 index 0000000..cba1f12 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/InsertSnippetCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class InsertSnippetCommandArgs : EditorCommandArgs + { + public InsertSnippetCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeCompletionListCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeCompletionListCommandArgs.cs new file mode 100644 index 0000000..8cd8bc3 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeCompletionListCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class InvokeCompletionListCommandArgs : EditorCommandArgs + { + public InvokeCompletionListCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeQuickInfoCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeQuickInfoCommandArgs.cs new file mode 100644 index 0000000..4e317b5 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeQuickInfoCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class InvokeQuickInfoCommandArgs : EditorCommandArgs + { + public InvokeQuickInfoCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeSignatureHelpCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeSignatureHelpCommandArgs.cs new file mode 100644 index 0000000..09a2b52 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/InvokeSignatureHelpCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class InvokeSignatureHelpCommandArgs : EditorCommandArgs + { + public InvokeSignatureHelpCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/LeftKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/LeftKeyCommandArgs.cs new file mode 100644 index 0000000..5bdc8b7 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/LeftKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class LeftKeyCommandArgs : EditorCommandArgs + { + public LeftKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndCommandArgs.cs new file mode 100644 index 0000000..320c096 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class LineEndCommandArgs : EditorCommandArgs + { + public LineEndCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndExtendCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndExtendCommandArgs.cs new file mode 100644 index 0000000..ab66007 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineEndExtendCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class LineEndExtendCommandArgs : EditorCommandArgs + { + public LineEndExtendCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartCommandArgs.cs new file mode 100644 index 0000000..decb21d --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class LineStartCommandArgs : EditorCommandArgs + { + public LineStartCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartExtendCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartExtendCommandArgs.cs new file mode 100644 index 0000000..1282c85 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/LineStartExtendCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class LineStartExtendCommandArgs : EditorCommandArgs + { + public LineStartExtendCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesDownCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesDownCommandArgs.cs new file mode 100644 index 0000000..2c3d701 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesDownCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class MoveSelectedLinesDownCommandArgs : EditorCommandArgs + { + public MoveSelectedLinesDownCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesUpCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesUpCommandArgs.cs new file mode 100644 index 0000000..c92378a --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/MoveSelectedLinesUpCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class MoveSelectedLinesUpCommandArgs : EditorCommandArgs + { + public MoveSelectedLinesUpCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToNextHighlightedReferenceCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToNextHighlightedReferenceCommandArgs.cs new file mode 100644 index 0000000..d8353b9 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToNextHighlightedReferenceCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class NavigateToNextHighlightedReferenceCommandArgs : EditorCommandArgs + { + public NavigateToNextHighlightedReferenceCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToPreviousHighlightedReferenceCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToPreviousHighlightedReferenceCommandArgs.cs new file mode 100644 index 0000000..86cbf14 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/NavigateToPreviousHighlightedReferenceCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class NavigateToPreviousHighlightedReferenceCommandArgs : EditorCommandArgs + { + public NavigateToPreviousHighlightedReferenceCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineAboveCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineAboveCommandArgs.cs new file mode 100644 index 0000000..5a2f736 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineAboveCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class OpenLineAboveCommandArgs : EditorCommandArgs + { + public OpenLineAboveCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineBelowCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineBelowCommandArgs.cs new file mode 100644 index 0000000..808bbac --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/OpenLineBelowCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class OpenLineBelowCommandArgs : EditorCommandArgs + { + public OpenLineBelowCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/PageDownKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/PageDownKeyCommandArgs.cs new file mode 100644 index 0000000..f54a5df --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/PageDownKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class PageDownKeyCommandArgs : EditorCommandArgs + { + public PageDownKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/PageUpKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/PageUpKeyCommandArgs.cs new file mode 100644 index 0000000..0887797 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/PageUpKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class PageUpKeyCommandArgs : EditorCommandArgs + { + public PageUpKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/PasteCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/PasteCommandArgs.cs new file mode 100644 index 0000000..d307787 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/PasteCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class PasteCommandArgs : EditorCommandArgs + { + public PasteCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/RedoCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/RedoCommandArgs.cs new file mode 100644 index 0000000..5e606b8 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/RedoCommandArgs.cs @@ -0,0 +1,12 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class RedoCommandArgs : EditorCommandArgs + { + public readonly int Count; + + public RedoCommandArgs(ITextView textView, ITextBuffer subjectBuffer, int count = 1) : base(textView, subjectBuffer) + { + this.Count = count; + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/RemoveParametersCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/RemoveParametersCommandArgs.cs new file mode 100644 index 0000000..d34e1ae --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/RemoveParametersCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class RemoveParametersCommandArgs : EditorCommandArgs + { + public RemoveParametersCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/RenameCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/RenameCommandArgs.cs new file mode 100644 index 0000000..6439a59 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/RenameCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class RenameCommandArgs : EditorCommandArgs + { + public RenameCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ReorderParametersCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ReorderParametersCommandArgs.cs new file mode 100644 index 0000000..b582981 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ReorderParametersCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ReorderParametersCommandArgs : EditorCommandArgs + { + public ReorderParametersCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ReturnKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ReturnKeyCommandArgs.cs new file mode 100644 index 0000000..d2744ce --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ReturnKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ReturnKeyCommandArgs : EditorCommandArgs + { + public ReturnKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/RightKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/RightKeyCommandArgs.cs new file mode 100644 index 0000000..45b2b8c --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/RightKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class RightKeyCommandArgs : EditorCommandArgs + { + public RightKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/SaveCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/SaveCommandArgs.cs new file mode 100644 index 0000000..1a45c29 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/SaveCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class SaveCommandArgs : EditorCommandArgs + { + public SaveCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/SelectAllCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/SelectAllCommandArgs.cs new file mode 100644 index 0000000..829b978 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/SelectAllCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class SelectAllCommandArgs : EditorCommandArgs + { + public SelectAllCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/StartAutomaticOutliningCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/StartAutomaticOutliningCommandArgs.cs new file mode 100644 index 0000000..ad097e5 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/StartAutomaticOutliningCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class StartAutomaticOutliningCommandArgs : EditorCommandArgs + { + public StartAutomaticOutliningCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/SurroundWithCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/SurroundWithCommandArgs.cs new file mode 100644 index 0000000..844451e --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/SurroundWithCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class SurroundWithCommandArgs : EditorCommandArgs + { + public SurroundWithCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/SyncClassViewCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/SyncClassViewCommandArgs.cs new file mode 100644 index 0000000..3ecd832 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/SyncClassViewCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class SyncClassViewCommandArgs : EditorCommandArgs + { + public SyncClassViewCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/TabKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/TabKeyCommandArgs.cs new file mode 100644 index 0000000..24a9c25 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/TabKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class TabKeyCommandArgs : EditorCommandArgs + { + public TabKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ToggleCompletionModeCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ToggleCompletionModeCommandArgs.cs new file mode 100644 index 0000000..ddbfa6b --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ToggleCompletionModeCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ToggleCompletionModeCommandArgs : EditorCommandArgs + { + public ToggleCompletionModeCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/TypeCharCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/TypeCharCommandArgs.cs new file mode 100644 index 0000000..9ff72dc --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/TypeCharCommandArgs.cs @@ -0,0 +1,11 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class TypeCharCommandArgs : EditorCommandArgs + { + public char TypedChar { get; } + public TypeCharCommandArgs(ITextView textView, ITextBuffer subjectBuffer, char typedChar) : base(textView, subjectBuffer) + { + TypedChar = typedChar; + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/UncommentSelectionCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/UncommentSelectionCommandArgs.cs new file mode 100644 index 0000000..9c46e39 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/UncommentSelectionCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class UncommentSelectionCommandArgs : EditorCommandArgs + { + public UncommentSelectionCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/UndoCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/UndoCommandArgs.cs new file mode 100644 index 0000000..ce0df8b --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/UndoCommandArgs.cs @@ -0,0 +1,12 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class UndoCommandArgs : EditorCommandArgs + { + public readonly int Count; + + public UndoCommandArgs(ITextView textView, ITextBuffer subjectBuffer, int count = 1) : base(textView, subjectBuffer) + { + this.Count = count; + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/UpKeyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/UpKeyCommandArgs.cs new file mode 100644 index 0000000..29b6bb2 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/UpKeyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class UpKeyCommandArgs : EditorCommandArgs + { + public UpKeyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/ViewCallHierarchyCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/ViewCallHierarchyCommandArgs.cs new file mode 100644 index 0000000..3eea996 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/ViewCallHierarchyCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class ViewCallHierarchyCommandArgs : EditorCommandArgs + { + public ViewCallHierarchyCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToEndCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToEndCommandArgs.cs new file mode 100644 index 0000000..eeeddc5 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToEndCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class WordDeleteToEndCommandArgs : EditorCommandArgs + { + public WordDeleteToEndCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToStartCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToStartCommandArgs.cs new file mode 100644 index 0000000..5d8c532 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/Commands/WordDeleteToStartCommandArgs.cs @@ -0,0 +1,9 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding.Commands +{ + public sealed class WordDeleteToStartCommandArgs : EditorCommandArgs + { + public WordDeleteToStartCommandArgs(ITextView textView, ITextBuffer subjectBuffer) : base(textView, subjectBuffer) + { + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/EditorCommandArgs.cs b/src/Editor/Text/Def/TextUI/Commanding/EditorCommandArgs.cs new file mode 100644 index 0000000..deaf9cb --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/EditorCommandArgs.cs @@ -0,0 +1,33 @@ +using System; +using Microsoft.VisualStudio.Commanding; + +namespace Microsoft.VisualStudio.Text.Editor.Commanding +{ + /// <summary> + /// A base class for all editor command arguments. + /// </summary> + public abstract class EditorCommandArgs : CommandArgs + { + /// <summary> + /// A subject buffer to execute a command on. + /// </summary> + public ITextBuffer SubjectBuffer { get; } + + /// <summary> + /// An <see cref="ITextView"/> to execute a command on. + /// </summary> + public ITextView TextView { get; } + + /// <summary> + /// Creates new instance of the <see cref="EditorCommandArgs"/> with given + /// <see cref="ITextView"/> and <see cref="ITextBuffer"/>. + /// </summary> + /// <param name="textView">A <see cref="ITextView"/> to execute a command on.</param> + /// <param name="subjectBuffer">A <see cref="ITextBuffer"/> to execute command on.</param> + public EditorCommandArgs(ITextView textView, ITextBuffer subjectBuffer) + { + this.TextView = textView ?? throw new ArgumentNullException(nameof(textView)); + this.SubjectBuffer = subjectBuffer ?? throw new ArgumentNullException(nameof(subjectBuffer)); + } + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/IChainedCommandHandler.cs b/src/Editor/Text/Def/TextUI/Commanding/IChainedCommandHandler.cs new file mode 100644 index 0000000..7dab7e3 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/IChainedCommandHandler.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.VisualStudio.Utilities; + +namespace Microsoft.VisualStudio.Commanding +{ + /// <summary> + /// Represents a command handler that depends on behavior of following command handlers in the command execution chain + /// formed from same strongly-typed <see cref="ICommandHandler"/>s ordered according to their [Order] attributes. + /// </summary> + /// <remarks> + /// This is a MEF component part and should be exported as the non-generic <see cref="ICommandHandler"/> with required + /// [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes. + /// </remarks> + /// <example> + /// [Export(typeof(ICommandHandler))] + /// [Name(nameof(MyCommandHandler))] + /// [ContentType("text")] + /// [Order(Before ="OtherCommandHandler")] + /// [TextViewRole(PredefinedTextViewRoles.Editable)] + /// internal class MyCommandHandler : IChainedCommandHandler<MyCommandArgs> + /// </example> + public interface IChainedCommandHandler<T> : ICommandHandler, INamed where T : CommandArgs + { + /// <summary> + /// Called to determine the state of the command. + /// </summary> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <param name="nextCommandHandler">The next command handler in the command execution chain.</param> + /// <returns>A <see cref="CommandState"/> instance that contains information on the availability of the command.</returns> + CommandState GetCommandState(T args, Func<CommandState> nextCommandHandler); + + /// <summary> + /// Called to execute the command. + /// </summary> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <param name="nextCommandHandler">The next command handler in the command execution chain.</param> + void ExecuteCommand(T args, Action nextCommandHandler, CommandExecutionContext executionContext); + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/ICommandHandler.cs b/src/Editor/Text/Def/TextUI/Commanding/ICommandHandler.cs new file mode 100644 index 0000000..c999be2 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/ICommandHandler.cs @@ -0,0 +1,56 @@ +using Microsoft.VisualStudio.Utilities; + +namespace Microsoft.VisualStudio.Commanding +{ + /// <summary> + /// This interface marks a class that implements at least one strongly-typed + /// <see cref="ICommandHandler{T}"/> or <see cref="IChainedCommandHandler{T}"/>. + /// </summary> + /// <remarks> + /// This is a MEF component part and should be exported as the non-generic <see cref="ICommandHandler"/> with required + /// [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes. + /// </remarks> + /// <example> + /// [Export(typeof(ICommandHandler))] + /// [Name(nameof(MyCommandHandler))] + /// [ContentType("text")] + /// [Order(Before ="OtherCommandHandler")] + /// [TextViewRole(PredefinedTextViewRoles.Editable)] + /// internal class MyCommandHandler : ICommandHandler<MyCommandArgs> + /// </example> + public interface ICommandHandler + { + } + + /// <summary> + /// Represents a handler for a command associated with specific <see cref="CommandArgs"/>. + /// </summary> + /// <remarks> + /// This is a MEF component part and should be exported as the non-generic <see cref="ICommandHandler"/> with required + /// [Name], [ContentType] attributes and optional [Order] and [TextViewRole] attributes. + /// </remarks> + /// <example> + /// [Export(typeof(ICommandHandler))] + /// [Name(nameof(MyCommandHandler))] + /// [ContentType("text")] + /// [Order(Before ="OtherCommandHandler")] + /// [TextViewRole(PredefinedTextViewRoles.Editable)] + /// internal class MyCommandHandler : ICommandHandler<MyCommandArgs> + /// </example> + public interface ICommandHandler<T> : ICommandHandler, INamed where T : CommandArgs + { + /// <summary> + /// Called to determine the state of the command. + /// </summary> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <returns>A <see cref="CommandState"/> instance that contains information on the availability of the command.</returns> + CommandState GetCommandState(T args); + + /// <summary> + /// Called to execute the command. + /// </summary> + /// <param name="args">The <see cref="CommandArgs"/> arguments for the command.</param> + /// <returns>Returns <c>true</c> if the command was handled, <c>false</c> otherwise.</returns> + bool ExecuteCommand(T args, CommandExecutionContext executionContext); + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolver.cs b/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolver.cs new file mode 100644 index 0000000..4cf5a12 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolver.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Microsoft.VisualStudio.Text.Editor.Commanding +{ + /// <summary> + /// Given a text view and a command type, resolves a list of text buffers on which a command should be executed. + /// Default implementation of this service returns a list of buffers in the text view which can be mapped + /// to the caret position. Other implementations might take into acount text selection in addition to the caret position, + /// for example when executing Format Document command in a projection scenario. + /// </summary> + public interface ICommandingTextBufferResolver + { + /// <summary> + /// Given a command type, resolves a list of text buffers on which a command should be executed. + /// </summary> + /// <typeparam name="TArgs">Command type.</typeparam> + /// <returns>A list of text buffers on which a command should be executed.</returns> + IEnumerable<ITextBuffer> ResolveBuffersForCommand<TArgs>() where TArgs : EditorCommandArgs; + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolverProvider.cs b/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolverProvider.cs new file mode 100644 index 0000000..eef5914 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/ICommandingTextBufferResolverProvider.cs @@ -0,0 +1,23 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding +{ + /// <summary> + /// Provides a <see cref="ICommandingTextBufferResolver"/> for a given + /// <see cref="ITextView"/> and content type. + /// </summary> + /// <remarks>This is a MEF component and should be exported as + /// + /// Export(typeof(ICommandingTextBufferResolverProvider))] + /// [ContentType("MyContentType")] + /// internal class MyBufferResolverProvider : ICommandingTextBufferResolverProvider + /// </remarks> + public interface ICommandingTextBufferResolverProvider + { + /// <summary> + /// Creates a <see cref="ICommandingTextBufferResolver"/> for a given + /// <see cref="ITextView"/>. + /// </summary> + /// <param name="textView">A <see cref="ITextView"/> to create a text buffer resolver for.</param> + /// <returns>A new instance of <see cref="ICommandingTextBufferResolver"/>.</returns> + ICommandingTextBufferResolver CreateResolver(ITextView textView); + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerService.cs b/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerService.cs new file mode 100644 index 0000000..2516bd7 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerService.cs @@ -0,0 +1,32 @@ +using Microsoft.VisualStudio.Commanding; +using System; + +namespace Microsoft.VisualStudio.Text.Editor.Commanding +{ + /// <summary> + /// A service to execute commands on a text view. + /// </summary> + /// <remarks> + /// Instance of this service are created by <see cref="IEditorCommandHandlerServiceFactory"/>. + /// </remarks> + public interface IEditorCommandHandlerService + { + /// <summary> + /// Get the <see cref="CommandState"/> for command handlers of a given command. + /// </summary> + /// <param name="argsFactory">A factory of <see cref="EditorCommandArgs"/> that specifies what kind of command is being queried.</param> + /// <param name="nextCommandHandler">A next command handler to be called if no command handlers were + /// able to determine a command state.</param> + /// <typeparam name="T">Tehe </typeparam> + /// <returns>The command state of a given command.</returns> + CommandState GetCommandState<T>(Func<ITextView, ITextBuffer, T> argsFactory, Func<CommandState> nextCommandHandler) where T : EditorCommandArgs; + + /// <summary> + /// Execute a given command on the <see cref="ITextView"/> associated with this <see cref="IEditorCommandHandlerService"/> instance. + /// </summary> + /// <param name="argsFactory">A factory of <see cref="EditorCommandArgs"/> that specifies what kind of command is being executed. + /// <paramref name="nextCommandHandler">>A next command handler to be called if no command handlers were + /// able to handle a command.</paramref> + void Execute<T>(Func<ITextView, ITextBuffer, T> argsFactory, Action nextCommandHandler) where T : EditorCommandArgs; + } +} diff --git a/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerServiceFactory.cs b/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerServiceFactory.cs new file mode 100644 index 0000000..226deb2 --- /dev/null +++ b/src/Editor/Text/Def/TextUI/Commanding/IEditorCommandHandlerServiceFactory.cs @@ -0,0 +1,27 @@ +namespace Microsoft.VisualStudio.Text.Editor.Commanding +{ + /// <summary> + /// A factory producing <see cref="IEditorCommandHandlerService"/> used to execute commands in a given text view. + /// </summary> + /// <remarks> + /// This is a MEF component and should be imported as + /// + /// [Import] + /// private IEditorCommandHandlerServiceFactory factory; + /// </remarks> + public interface IEditorCommandHandlerServiceFactory + { + /// <summary> + /// Gets or creates a <see cref="IEditorCommandHandlerService"/> for a given <see cref="ITextView"/>. + /// </summary> + /// <param name="textView">A text view to get or create <see cref="IEditorCommandHandlerService"/> for.</param> + IEditorCommandHandlerService GetService(ITextView textView); + + /// <summary> + /// Gets or creates a <see cref="IEditorCommandHandlerService"/> for a given <see cref="ITextView"/> and <see cref="ITextBuffer"/>. + /// </summary> + /// <param name="textView">A text view to get or create <see cref="IEditorCommandHandlerService"/> for.</param> + /// <param name="subjectBuffer">A text buffer to get or create <see cref="IEditorCommandHandlerService"/> for.</param> + IEditorCommandHandlerService GetService(ITextView textView, ITextBuffer subjectBuffer); + } +} |