コード例 #1
0
        protected void VerifyOpenLineBelow(string initialMarkup, string expectedMarkup, bool useTabs = false, bool autoGenerateXmlDocComments = true)
        {
            Verify(initialMarkup, expectedMarkup, useTabs, autoGenerateXmlDocComments,
                   execute: (workspace, view, editorOperationsFactoryService) =>
            {
                var commandHandler = CreateCommandHandler(workspace);

                var commandArgs = new OpenLineBelowCommandArgs(view, view.TextBuffer);
                void nextHandler()
                {
                    var editorOperations = editorOperationsFactoryService.GetEditorOperations(view);
                    editorOperations.OpenLineBelow();
                }

                commandHandler.ExecuteCommand(commandArgs, nextHandler, TestCommandExecutionContext.Create());
            });
        }
コード例 #2
0
        protected async Task VerifyOpenLineBelowAsync(string initialMarkup, string expectedMarkup, bool useTabs = false, bool autoGenerateXmlDocComments = true)
        {
            await VerifyAsync(initialMarkup, expectedMarkup, useTabs, autoGenerateXmlDocComments,
                              execute : (view, undoHistoryRegistry, editorOperationsFactoryService, completionService) =>
            {
                var commandHandler = CreateCommandHandler(TestWaitIndicator.Default, undoHistoryRegistry, editorOperationsFactoryService, completionService) as ICommandHandler <OpenLineBelowCommandArgs>;

                var commandArgs    = new OpenLineBelowCommandArgs(view, view.TextBuffer);
                Action nextHandler = () =>
                {
                    var editorOperations = editorOperationsFactoryService.GetEditorOperations(view);
                    editorOperations.OpenLineBelow();
                };

                commandHandler.ExecuteCommand(commandArgs, nextHandler);
            });
        }
コード例 #3
0
        internal void VerifyOpenLineBelow(string initialMarkup, string expectedMarkup, bool useTabs = false, string newLine = "\r\n", bool trimTrailingWhiteSpace = false, OptionsCollection globalOptions = null)
        {
            Verify(initialMarkup, expectedMarkup,
                   execute: (workspace, view, editorOperationsFactoryService) =>
            {
                var commandHandler = CreateCommandHandler(workspace);

                var commandArgs = new OpenLineBelowCommandArgs(view, view.TextBuffer);
                void nextHandler()
                {
                    var editorOperations = editorOperationsFactoryService.GetEditorOperations(view);
                    editorOperations.OpenLineBelow();
                }

                commandHandler.ExecuteCommand(commandArgs, nextHandler, TestCommandExecutionContext.Create());
            },
                   useTabs, newLine, trimTrailingWhiteSpace, globalOptions);
        }
コード例 #4
0
        public void ExecuteCommand(OpenLineBelowCommandArgs args, Action nextHandler)
        {
            // Check to see if the current line starts with exterior trivia. If so, we'll take over.
            // If not, let the nextHandler run.

            var caretPosition = args.TextView.GetCaretPoint(args.SubjectBuffer) ?? -1;

            if (caretPosition < 0)
            {
                nextHandler();
                return;
            }

            if (!CurrentLineStartsWithExteriorTrivia(args.SubjectBuffer, caretPosition))
            {
                nextHandler();
                return;
            }

            // Allow nextHandler() to run and the insert exterior trivia if necessary.
            nextHandler();

            InsertExteriorTriviaIfNeeded(args.TextView, args.SubjectBuffer);
        }
コード例 #5
0
 public CommandState GetCommandState(OpenLineBelowCommandArgs args, Func <CommandState> nextHandler)
 {
     return(nextHandler());
 }
コード例 #6
0
 public CommandState GetCommandState(OpenLineBelowCommandArgs args, Func <CommandState> nextHandler)
 => nextHandler();
コード例 #7
0
 bool ICommandHandler <OpenLineBelowCommandArgs> .ExecuteCommand(OpenLineBelowCommandArgs args, CommandExecutionContext executionContext)
 {
     GetOperations(args.TextView).OpenLineBelow();
     return(true);
 }
コード例 #8
0
 CommandState ICommandHandler <OpenLineBelowCommandArgs> .GetCommandState(OpenLineBelowCommandArgs args)
 {
     return(AvailableInEditableView(args.TextView));
 }