internal PythonToolsService(IServiceContainer container, bool forTests = false) { _forTests = forTests; _container = container; _langPrefs = new Lazy <LanguagePreferences>(() => new LanguagePreferences(Site, typeof(PythonLanguageInfo).GUID)); _interpreterOptionsService = new Lazy <IInterpreterOptionsService>(Site.GetComponentModel().GetService <IInterpreterOptionsService>); _interpreterRegistryService = new Lazy <IInterpreterRegistryService>(Site.GetComponentModel().GetService <IInterpreterRegistryService>); _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); _idleManager = !forTests ? new IdleManager(container) : null; _formattingOptions = new Lazy <PythonFormattingOptions>(CreateFormattingOptions); _advancedEditorOptions = new Lazy <PythonAdvancedEditorOptions>(CreateAdvancedEditorOptions); _debuggerOptions = new Lazy <PythonDebuggingOptions>(CreateDebuggerOptions); _condaOptions = new Lazy <PythonCondaOptions>(CreateCondaOptions); _analysisOptions = new Lazy <PythonAnalysisOptions>(CreateAnalysisOptions); _generalOptions = new Lazy <PythonGeneralOptions>(CreateGeneralOptions); _suppressDialogOptions = new Lazy <SuppressDialogOptions>(() => new SuppressDialogOptions(this)); _interactiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Interactive")); _debugInteractiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Debug Interactive Window")); _diagnosticsProvider = new DiagnosticsProvider(container); Logger = (IPythonToolsLogger)container.GetService(typeof(IPythonToolsLogger)); EnvironmentSwitcherManager = new EnvironmentSwitcherManager(container); WorkspaceInfoBarManager = new WorkspaceInfoBarManager(container); if (_idleManager != null) { _idleManager.OnIdle += OnIdleInitialization; } }
internal PythonToolsService(IServiceContainer container) { _container = container; _analyzers = new ConcurrentDictionary <string, VsProjectAnalyzer>(); _langPrefs = new Lazy <LanguagePreferences>(() => new LanguagePreferences(this, typeof(PythonLanguageInfo).GUID)); _interpreterOptionsService = new Lazy <IInterpreterOptionsService>(Site.GetComponentModel().GetService <IInterpreterOptionsService>); _interpreterRegistryService = new Lazy <IInterpreterRegistryService>(Site.GetComponentModel().GetService <IInterpreterRegistryService>); _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); _idleManager = new IdleManager(container); _advancedOptions = new Lazy <AdvancedEditorOptions>(CreateAdvancedEditorOptions); _debuggerOptions = new Lazy <DebuggerOptions>(CreateDebuggerOptions); _condaOptions = new Lazy <CondaOptions>(CreateCondaOptions); _diagnosticsOptions = new Lazy <DiagnosticsOptions>(CreateDiagnosticsOptions); _generalOptions = new Lazy <GeneralOptions>(CreateGeneralOptions); _languageServerOptions = new Lazy <LanguageServerOptions>(CreateLanguageServerOptions); _suppressDialogOptions = new Lazy <SuppressDialogOptions>(() => new SuppressDialogOptions(this)); _interactiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Interactive")); _debugInteractiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Debug Interactive Window")); _diagnosticsProvider = new DiagnosticsProvider(container); Logger = (IPythonToolsLogger)container.GetService(typeof(IPythonToolsLogger)); EnvironmentSwitcherManager = new EnvironmentSwitcherManager(container); WorkspaceInfoBarManager = new WorkspaceInfoBarManager(container); _idleManager.OnIdle += OnIdleInitialization; EditorServices = ComponentModel.GetService <PythonEditorServices>(); EditorServices.SetPythonToolsService(this); }
public void Dispose() { if (_langPrefs.IsValueCreated) { _langPrefs.Value.Dispose(); } _idleManager.Dispose(); EnvironmentSwitcherManager.Dispose(); WorkspaceInfoBarManager.Dispose(); }
public void Dispose() { if (_langPrefs.IsValueCreated) { _langPrefs.Value.Dispose(); } _idleManager.Dispose(); foreach (var window in _codeWindowManagers.Values.ToArray()) { window.RemoveAdornments(); } _codeWindowManagers.Clear(); foreach (var kv in GetActiveSharedAnalyzers()) { kv.Value.Dispose(); } EnvironmentSwitcherManager.Dispose(); WorkspaceInfoBarManager.Dispose(); }