internal void CheckStart(IBraceCompletionSession session, bool expectValidSession = true) { Type(session, session.OpeningBrace.ToString()); session.Start(); if (expectValidSession) { var closingPoint = session.ClosingPoint.GetPoint(session.SubjectBuffer.CurrentSnapshot).Subtract(1); Assert.Equal(closingPoint.GetChar(), session.ClosingBrace); } else { Assert.Null(session.OpeningPoint); Assert.Null(session.ClosingPoint); } }
public void PushSession(IBraceCompletionSession session) { ITextView view = null; ITextBuffer buffer = null; _guardedOperations.CallExtensionPoint(() => { view = session.TextView; buffer = session.SubjectBuffer; }); if (view != null && buffer != null) { SetCurrentBuffer(buffer); bool validStart = false; // start the session to add the closing brace _guardedOperations.CallExtensionPoint(() => { session.Start(); // verify the session is valid before going on. // some sessions may want to leave the stack at this point validStart = (session.OpeningPoint != null && session.ClosingPoint != null); }); if (validStart) { // highlight the brace ITrackingPoint closingPoint = null; _guardedOperations.CallExtensionPoint(() => { closingPoint = session.ClosingPoint; }); HighlightSpan(closingPoint); // put it on the stack for tracking _stack.Push(session); } } }