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()); }); }
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); }); }
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); }
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); }
public CommandState GetCommandState(OpenLineBelowCommandArgs args, Func <CommandState> nextHandler) { return(nextHandler()); }
public CommandState GetCommandState(OpenLineBelowCommandArgs args, Func <CommandState> nextHandler) => nextHandler();
bool ICommandHandler <OpenLineBelowCommandArgs> .ExecuteCommand(OpenLineBelowCommandArgs args, CommandExecutionContext executionContext) { GetOperations(args.TextView).OpenLineBelow(); return(true); }
CommandState ICommandHandler <OpenLineBelowCommandArgs> .GetCommandState(OpenLineBelowCommandArgs args) { return(AvailableInEditableView(args.TextView)); }