public void PreReturn(out bool handledCommand) { bool handled = false; Debug.Assert(_postSession == null, "_postSession should have been cleared"); if (_stack.TopSession != null && !HasSelection) { IBraceCompletionSession session = _stack.TopSession; _guardedOperations.CallExtensionPoint(() => { if (IsSingleLine(session.OpeningPoint, session.ClosingPoint)) { session.PreReturn(out handled); if (!handled) { _postSession = session; } } }); } handledCommand = handled; }
internal void CheckReturnOnNonEmptyLine(IBraceCompletionSession session, int expectedVirtualSpace) { bool handled; session.PreReturn(out handled); Type(session, Environment.NewLine); if (!handled) { session.PostReturn(); } var virtualCaret = session.TextView.GetVirtualCaretPoint(session.SubjectBuffer).Value; Assert.Equal(expectedVirtualSpace, virtualCaret.VirtualSpaces); }
internal void CheckReturn(IBraceCompletionSession session, int indentation, string result = null) { bool handled; session.PreReturn(out handled); Type(session, Environment.NewLine); if (!handled) { session.PostReturn(); } var virtualCaret = session.TextView.GetVirtualCaretPoint(session.SubjectBuffer).Value; Assert.Equal(indentation, virtualCaret.VirtualSpaces); if (result != null) { Assert.Equal(result, session.SubjectBuffer.CurrentSnapshot.GetText()); } }