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); }
public AddInstalledEnvironmentView( IServiceProvider serviceProvider, ProjectView[] projects, ProjectView selectedProject ) : base(serviceProvider, projects, selectedProject) { _logger = Site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; PageName = Strings.AddInstalledEnvironmentTabHeader; AcceptCaption = Strings.AddInstalledEnvironmentInstallButton; AcceptAutomationName = Strings.AddInstalledEnvironmentInstallButtonAutomationName; IsAcceptShieldVisible = true; _setupService = Site.GetService(typeof(SVsSetupCompositionService)) as IVsSetupCompositionService; _retargeting = Site.GetService(typeof(SVsTrackProjectRetargeting)) as IVsTrackProjectRetargeting2; var packages = GetPackages(_setupService) .Where(p => p.PackageId.StartsWithOrdinal("Component.CPython")) .Select(p => new SetupPackageView( p.PackageId, p.Title, p.CurrentState == (uint)__VsSetupPackageState.INSTALL_PACKAGE_PRESENT, RefreshAcceptButton )); SetupPackages = new ObservableCollection <SetupPackageView>(packages); InstalledView = new ListCollectionView(SetupPackages); InstalledView.Filter = (p => ((SetupPackageView)p).Installed); AvailableView = new ListCollectionView(SetupPackages); AvailableView.Filter = (p => !((SetupPackageView)p).Installed); RefreshAcceptButton(); }
public CurrentEnvironmentCommand(IServiceProvider serviceProvider) : base(null, null, QueryStatus, new CommandID(GuidList.guidPythonToolsCmdSet, (int)PkgCmdIDList.comboIdCurrentEnvironment)) { _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _envSwitchMgr = serviceProvider.GetPythonToolsService().EnvironmentSwitcherManager; _logger = serviceProvider.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; }
public AddVirtualEnvironmentOperation( IServiceProvider site, PythonProjectNode project, string virtualEnvPath, string baseInterpreterId, bool useVEnv, bool installRequirements, string requirementsPath, bool registerAsCustomEnv, string customEnvName, bool setAsCurrent, bool setAsDefault, bool viewInEnvWindow, Redirector output = null ) { _site = site ?? throw new ArgumentNullException(nameof(site)); _project = project; _virtualEnvPath = virtualEnvPath ?? throw new ArgumentNullException(nameof(virtualEnvPath)); _baseInterpreter = baseInterpreterId ?? throw new ArgumentNullException(nameof(baseInterpreterId)); _useVEnv = useVEnv; _installReqs = installRequirements; _reqsPath = requirementsPath; _registerAsCustomEnv = registerAsCustomEnv; _customEnvName = customEnvName; _setAsCurrent = setAsCurrent; _setAsDefault = setAsDefault; _viewInEnvWindow = viewInEnvWindow; _output = output; _statusCenter = _site.GetService(typeof(SVsTaskStatusCenterService)) as IVsTaskStatusCenterService; _registry = _site.GetComponentModel().GetService <IInterpreterRegistryService>(); _options = _site.GetComponentModel().GetService <IInterpreterOptionsService>(); _logger = _site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; }
public AddExistingEnvironmentView( IServiceProvider serviceProvider, ProjectView[] projects, ProjectView selectedProject ) : base(serviceProvider, projects, selectedProject) { _logger = Site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; _allGlobalInterpreters = InterpreterView.GetInterpreters(Site, null).ToArray(); PageName = Strings.AddExistingEnvironmentTabHeader; ResetProjectDependentProperties(); }
public AddInstalledEnvironmentView( IServiceProvider serviceProvider, ProjectView[] projects, ProjectView selectedProject ) : base(serviceProvider, projects, selectedProject) { _logger = Site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; PageName = Strings.AddInstalledEnvironmentTabHeader; AcceptCaption = Strings.AddInstalledEnvironmentLaunch; IsAcceptShieldVisible = true; }
public WorkspaceAnalyzer( IPythonWorkspaceContext pythonWorkspace, IInterpreterOptionsService optionsService, IServiceProvider site ) { _pythonWorkspace = pythonWorkspace ?? throw new ArgumentNullException(nameof(pythonWorkspace)); _optionsService = optionsService ?? throw new ArgumentNullException(nameof(optionsService)); _site = site ?? throw new ArgumentNullException(nameof(site)); _logger = (IPythonToolsLogger)_site.GetService(typeof(IPythonToolsLogger)); _pendingChanges = new HashSet <AnalysisEntry>(); _pendingDeletes = new HashSet <AnalysisEntry>(); _recreatingAnalyzer = new SemaphoreSlim(1); _deferredWorkspaceFileChangeNotification = new Timer(OnDeferredWorkspaceFileChanged); _deferredModulesChangeNotification = new Timer(OnDeferredModulesChanged); _pythonWorkspace.ActiveInterpreterChanged += OnActiveInterpreterChanged; _pythonWorkspace.SearchPathsSettingChanged += OnSearchPathsChanged; }
public AddCondaEnvironmentOperation( IServiceProvider site, ICondaEnvironmentManager condaMgr, PythonProjectNode project, IPythonWorkspaceContext workspace, string envNameOrPath, string envFilePath, List <PackageSpec> packages, bool setAsCurrent, bool setAsDefault, bool viewInEnvWindow ) { _site = site ?? throw new ArgumentNullException(nameof(site)); _condaMgr = condaMgr ?? throw new ArgumentNullException(nameof(condaMgr)); _project = project; _workspace = workspace; _envNameOrPath = envNameOrPath ?? throw new ArgumentNullException(nameof(envNameOrPath)); _envFilePath = envFilePath; _packages = packages ?? throw new ArgumentNullException(nameof(packages)); _setAsCurrent = setAsCurrent; _setAsDefault = setAsDefault; _viewInEnvWindow = viewInEnvWindow; // If passed a path, the actual name reported by conda will the last part _actualName = PathUtils.GetFileOrDirectoryName(_envNameOrPath); if (_actualName.Length == 0) { _actualName = _envNameOrPath; } _outputWindow = OutputWindowRedirector.GetGeneral(_site); _statusBar = _site.GetService(typeof(SVsStatusbar)) as IVsStatusbar; _showAndActiveOutputWindow = _site.GetPythonToolsService().GeneralOptions.ShowOutputWindowForVirtualEnvCreate; _statusCenter = _site.GetService(typeof(SVsTaskStatusCenterService)) as IVsTaskStatusCenterService; _registry = _site.GetComponentModel().GetService <IInterpreterRegistryService>(); _options = _site.GetComponentModel().GetService <IInterpreterOptionsService>(); _logger = _site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; _factoryProvider = _site.GetComponentModel().GetService <CondaEnvironmentFactoryProvider>(); }
public PythonLanguageClientCustomTarget(IServiceProvider site, JoinableTaskContext joinableTaskContext) { _site = site ?? throw new ArgumentNullException(nameof(site)); _joinableTaskContext = joinableTaskContext; _logger = _site.GetService(typeof(IPythonToolsLogger)) as IPythonToolsLogger; }
public PythonToolsLogger(IPythonToolsLogger[] loggers) { _loggers = loggers; }