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; } }
public static void ImportFrom(this IPythonToolsOptionsService service, CodeFormattingOptions options) { foreach (var importer in ImportFromCodeFormattingOptionsLazy.Value) { importer(service, options); } }
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); _experimentalOptions = new Lazy <Options.ExperimentalOptions>(CreateExperimentalOptions); _diagnosticsOptions = new Lazy <DiagnosticsOptions>(CreateDiagnosticsOptions); _generalOptions = new Lazy <GeneralOptions>(CreateGeneralOptions); _suppressDialogOptions = new Lazy <SuppressDialogOptions>(() => new SuppressDialogOptions(this)); _interactiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Interactive")); _debugInteractiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Debug Interactive Window")); _logger = (IPythonToolsLogger)container.GetService(typeof(IPythonToolsLogger)); _diagnosticsProvider = new DiagnosticsProvider(container); _idleManager.OnIdle += OnIdleInitialization; EditorServices = ComponentModel.GetService <PythonEditorServices>(); EditorServices.SetPythonToolsService(this); }
internal PythonToolsService(IServiceContainer container) { _container = container; _langPrefs = new Lazy <LanguagePreferences>(() => new LanguagePreferences(this, typeof(PythonLanguageInfo).GUID)); _interpreterOptionsService = new Lazy <IInterpreterOptionsService>(CreateInterpreterOptionsService); _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); _idleManager = new IdleManager(container); _advancedOptions = new Lazy <AdvancedEditorOptions>(CreateAdvancedEditorOptions); _debuggerOptions = new Lazy <DebuggerOptions>(CreateDebuggerOptions); _experimentalOptions = new Lazy <Options.ExperimentalOptions>(CreateExperimentalOptions); _diagnosticsOptions = new Lazy <DiagnosticsOptions>(CreateDiagnosticsOptions); _generalOptions = new Lazy <GeneralOptions>(CreateGeneralOptions); _suppressDialogOptions = new Lazy <SuppressDialogOptions>(() => new SuppressDialogOptions(this)); _interactiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Interactive")); _debugInteractiveOptions = new Lazy <PythonInteractiveOptions>(() => CreateInteractiveOptions("Debug Interactive Window")); _logger = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray()); _entryService = (AnalysisEntryService)ComponentModel.GetService <IAnalysisEntryService>(); _diagnosticsProvider = new DiagnosticsProvider(container); _idleManager.OnIdle += OnIdleInitialization; EditorServices.SetPythonToolsService(this); }
internal PythonToolsService(IServiceContainer container) { _container = container; var langService = new PythonLanguageInfo(container); _container.AddService(langService.GetType(), langService, true); IVsTextManager textMgr = (IVsTextManager)container.GetService(typeof(SVsTextManager)); if (textMgr != null) { var langPrefs = new LANGPREFERENCES[1]; langPrefs[0].guidLang = typeof(PythonLanguageInfo).GUID; ErrorHandler.ThrowOnFailure(textMgr.GetUserPreferences(null, null, langPrefs, null)); _langPrefs = new LanguagePreferences(this, langPrefs[0]); Guid guid = typeof(IVsTextManagerEvents2).GUID; IConnectionPoint connectionPoint; ((IConnectionPointContainer)textMgr).FindConnectionPoint(ref guid, out connectionPoint); connectionPoint.Advise(_langPrefs, out _langPrefsTextManagerCookie); } _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); var compModel = (IComponentModel)container.GetService(typeof(SComponentModel)); _interpreterRegistry = compModel.GetService <IInterpreterRegistryService>(); if (_interpreterRegistry != null) { _interpreterRegistry.InterpretersChanged += InterpretersChanged; } _interpreterOptionsService = compModel.GetService <IInterpreterOptionsService>(); if (_interpreterOptionsService != null) // not available in some test cases... { _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer; LoadInterpreterOptions(); } _idleManager = new IdleManager(container); _advancedOptions = new AdvancedEditorOptions(this); _debuggerOptions = new DebuggerOptions(this); _generalOptions = new GeneralOptions(this); _surveyNews = new SurveyNewsService(container); _suppressDialogOptions = new SuppressDialogOptions(this); _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService, _interpreterRegistry); _globalInterpreterOptions.Load(); _interactiveOptions = new PythonInteractiveOptions(this, "Interactive"); _interactiveOptions.Load(); _debugInteractiveOptions = new PythonInteractiveOptions(this, "Debug Interactive Window"); _debuggerOptions.Load(); _factoryProviders = ComponentModel.DefaultExportProvider.GetExports <IPythonInterpreterFactoryProvider, Dictionary <string, object> >(); _logger = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray()); InitializeLogging(); }
internal PythonToolsService(IServiceContainer container) { _container = container; var langService = new PythonLanguageInfo(container); _container.AddService(langService.GetType(), langService, true); _langPrefs = new Lazy <LanguagePreferences>(() => new LanguagePreferences(this, typeof(PythonLanguageInfo).GUID)); _optionsService = (IPythonToolsOptionsService)container.GetService(typeof(IPythonToolsOptionsService)); var compModel = (IComponentModel)container.GetService(typeof(SComponentModel)); _interpreterRegistry = compModel.GetService <IInterpreterRegistryService>(); if (_interpreterRegistry != null) { _interpreterRegistry.InterpretersChanged += InterpretersChanged; } _interpreterOptionsService = compModel.GetService <IInterpreterOptionsService>(); if (_interpreterOptionsService != null) // not available in some test cases... { _interpreterOptionsService.DefaultInterpreterChanged += UpdateDefaultAnalyzer; LoadInterpreterOptions(); } _idleManager = new IdleManager(container); _advancedOptions = new AdvancedEditorOptions(this); _debuggerOptions = new DebuggerOptions(this); _generalOptions = new GeneralOptions(this); _surveyNews = new SurveyNewsService(container); _suppressDialogOptions = new SuppressDialogOptions(this); _globalInterpreterOptions = new GlobalInterpreterOptions(this, _interpreterOptionsService, _interpreterRegistry); _globalInterpreterOptions.Load(); _interactiveOptions = new PythonInteractiveOptions(this, "Interactive"); _interactiveOptions.Load(); _debugInteractiveOptions = new PythonInteractiveOptions(this, "Debug Interactive Window"); _debuggerOptions.Load(); _factoryProviders = ComponentModel.DefaultExportProvider.GetExports <IPythonInterpreterFactoryProvider, Dictionary <string, object> >(); _logger = new PythonToolsLogger(ComponentModel.GetExtensions <IPythonToolsLogger>().ToArray()); InitializeLogging(); }