public void ReplWindowCreated(IReplWindow window) { var textViewAdapter = _adapterFact.GetViewAdapter(window.TextView); BraceMatcher.WatchBraceHighlights(window.TextView, PythonToolsPackage.ComponentModel); new EditFilter(window.TextView, textViewAdapter, _editorOpsFactory.GetEditorOperations(window.TextView)); }
/// <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; }
/// <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; view.Closed += matcher.TextViewClosed; }
/// <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(PythonEditorServices editorServices, ITextView view) { var matcher = new BraceMatcher(editorServices, view); // 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; view.Closed += matcher.TextViewClosed; }