Exemplo n.º 1
0
        private async Task InitializeCurrentContext()
        {
            var workspace = _workspaceService.CurrentWorkspace;

            if (workspace != null)
            {
                var context = new PythonWorkspaceContext(workspace, await workspace.GetPropertyEvaluatorServiceAsync(), _optionsService.Value, _registryService.Value);

                // Workspace interpreter factory provider will rescan the
                // workspace folder for factories.
                WorkspaceOpening?.Invoke(this, new PythonWorkspaceContextEventArgs(context));

                lock (_currentContextLock) {
                    _currentContext = context;
                }

                // Workspace sets its interpreter factory instance
                // This can trigger WorkspaceInterpreterFactoryProvider discovery
                // which needs to look at this object's _currentContext, which is why we
                // set that before calling initialize.
                context.Initialize();

                // Let users know this workspace context is all initialized
                WorkspaceInitialized?.Invoke(this, new PythonWorkspaceContextEventArgs(context));
            }
        }
Exemplo n.º 2
0
        private void InitializeCurrentContext()
        {
            var workspace = _workspaceService.CurrentWorkspace;

            if (workspace != null)
            {
                var context = new PythonWorkspaceContext(workspace, _optionsService.Value, _registryService.Value);

                // Workspace interpreter factory provider will rescan the
                // workspace folder for factories.
                WorkspaceOpening?.Invoke(this, new PythonWorkspaceContextEventArgs(context));

                // Workspace sets its interpreter factory instance,
                // now that they've been discovered by the factory provider.
                context.Initialize();

                lock (_currentContextLock) {
                    _currentContext = context;
                }

                // Let users know this workspace context is all initialized
                WorkspaceInitialized?.Invoke(this, new PythonWorkspaceContextEventArgs(context));
            }
        }