/// <summary> /// Starts watching the provided text view for brace matching. When new braces are inserted /// in the text or when the cursor moves to a brace the matching braces are highlighted. /// </summary> public static void WatchBraceHighlights(ITextView view, IComponentModel componentModel) { var matcher = new BraceMatcher(view, componentModel); // position changed only fires when the caret is explicitly moved, not from normal text edits, // so we track both changes and position changed. view.Caret.PositionChanged += matcher.CaretPositionChanged; view.TextBuffer.Changed += matcher.TextBufferChanged; }