private static object CreateTaskProviderService(IServiceContainer container, Type type) { if (SuppressTaskProvider) { return(null); } if (typeof(ErrorTaskProvider).IsEquivalentTo(type) || typeof(ErrorTaskProvider).GUID == type.GUID) { return(ErrorTaskProvider.CreateService(container, typeof(ErrorTaskProvider))); } else if (typeof(CommentTaskProvider).IsEquivalentTo(type) || typeof(CommentTaskProvider).GUID == type.GUID) { return(CommentTaskProvider.CreateService(container, typeof(CommentTaskProvider))); } else { return(null); } }
internal VsProjectAnalyzer( IServiceProvider serviceProvider, IPythonInterpreter interpreter, IPythonInterpreterFactory factory, IPythonInterpreterFactory[] allFactories, bool implicitProject = true ) { _errorProvider = (ErrorTaskProvider)serviceProvider.GetService(typeof(ErrorTaskProvider)); _commentTaskProvider = (CommentTaskProvider)serviceProvider.GetService(typeof(CommentTaskProvider)); _unresolvedSquiggles = new UnresolvedImportSquiggleProvider(serviceProvider, _errorProvider); _queue = new ParseQueue(this); _analysisQueue = new AnalysisQueue(this); _analysisQueue.AnalysisStarted += AnalysisQueue_AnalysisStarted; _allFactories = allFactories; _interpreterFactory = factory; _implicitProject = implicitProject; if (interpreter != null) { _pyAnalyzer = PythonAnalyzer.Create(factory, interpreter); ReloadTask = _pyAnalyzer.ReloadModulesAsync().HandleAllExceptions(SR.ProductName, GetType()); ReloadTask.ContinueWith(_ => ReloadTask = null); interpreter.ModuleNamesChanged += OnModulesChanged; } _projectFiles = new ConcurrentDictionary<string, IProjectEntry>(StringComparer.OrdinalIgnoreCase); _pyService = serviceProvider.GetPythonToolsService(); _serviceProvider = serviceProvider; if (_pyAnalyzer != null) { _pyAnalyzer.Limits.CrossModule = _pyService.GeneralOptions.CrossModuleAnalysisLimit; // TODO: Load other limits from options } _userCount = 1; }