private ReplEditFilter( IVsTextView vsTextView, ITextView textView, IEditorOperations editorOps, IServiceProvider serviceProvider, IOleCommandTarget next ) { _vsTextView = vsTextView; _textView = textView; _editorOps = editorOps; _serviceProvider = serviceProvider; _componentModel = _serviceProvider.GetComponentModel(); _pyService = _serviceProvider.GetPythonToolsService(); _interactive = _textView.TextBuffer.GetInteractiveWindow(); _next = next; if (_interactive != null) { _selectEval = _interactive.Evaluator as SelectableReplEvaluator; } if (_selectEval != null) { _selectEval.EvaluatorChanged += EvaluatorChanged; _selectEval.AvailableEvaluatorsChanged += AvailableEvaluatorsChanged; } var mse = _interactive?.Evaluator as IMultipleScopeEvaluator; if (mse != null) { _scopeListVisible = mse.EnableMultipleScopes; mse.AvailableScopesChanged += AvailableScopesChanged; mse.MultipleScopeSupportChanged += MultipleScopeSupportChanged; } if (_next == null && _interactive != null) { ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next)); } }
private ReplEditFilter( IVsTextView vsTextView, ITextView textView, IEditorOperations editorOps, IServiceProvider serviceProvider, IOleCommandTarget next ) { _vsTextView = vsTextView; _textView = textView; _editorOps = editorOps; _serviceProvider = serviceProvider; _componentModel = _serviceProvider.GetComponentModel(); _pyService = _serviceProvider.GetPythonToolsService(); _interactive = _textView.TextBuffer.GetInteractiveWindow(); _next = next; if (_interactive != null) { _selectEval = _interactive.Evaluator as SelectableReplEvaluator; } if (_selectEval != null) { _selectEval.EvaluatorChanged += EvaluatorChanged; _selectEval.AvailableEvaluatorsChanged += AvailableEvaluatorsChanged; } var mse = _interactive?.Evaluator as IMultipleScopeEvaluator; if (mse != null) { _scopeListVisible = mse.EnableMultipleScopes; mse.AvailableScopesChanged += AvailableScopesChanged; mse.MultipleScopeSupportChanged += MultipleScopeSupportChanged; } if (_next == null && _interactive != null) { ErrorHandler.ThrowOnFailure(vsTextView.AddCommandFilter(this, out _next)); } }
public IVsInteractiveWindow Create(string replId, int curId = -1) { EnsureInterpretersAvailable(); if (curId < 0) { curId = GetNextId(); } var contentType = _contentTypeService.GetContentType(PythonCoreConstants.ContentType); var evaluator = new SelectableReplEvaluator(_serviceProvider, _evaluators, replId, curId.ToString()); var window = CreateInteractiveWindowInternal( evaluator, contentType, true, curId, Strings.ReplCaptionNoEvaluator, CommonGuidList.guidPythonLanguageServiceGuid, "PythonInteractive" ); lock (_windows) { _windows[curId] = window; _lruWindows.Add(window); } window.InteractiveWindow.TextView.Closed += (s, e) => { lock (_windows) { Debug.Assert(ReferenceEquals(_windows[curId], window)); _windows.Remove(curId); _lruWindows.Remove(window); } }; return(window); }