Exemple #1
0
        public PythonAnalyzerEntry(EmptyAnalysis emptyAnalysis)
        {
            _previousAnalysis = emptyAnalysis;
            _isUserModule     = emptyAnalysis.Document.ModuleType == ModuleType.User;

            _bufferVersion   = -1;
            _analysisVersion = 0;
            _analysisTcs     = new TaskCompletionSource <IDocumentAnalysis>(TaskCreationOptions.RunContinuationsAsynchronously);
        }
        public async Task <IDocumentAnalysis> GetAnalysisAsync(IPythonModule module, int waitTime, CancellationToken cancellationToken)
        {
            var key = new AnalysisModuleKey(module);
            PythonAnalyzerEntry entry;

            lock (_syncObj) {
                if (!_analysisEntries.TryGetValue(key, out entry))
                {
                    var emptyAnalysis = new EmptyAnalysis(_services, (IDocument)module);
                    entry = new PythonAnalyzerEntry(emptyAnalysis);
                    _analysisEntries[key] = entry;
                }
            }

            if (waitTime < 0 || Debugger.IsAttached)
            {
                return(await GetAnalysisAsync(entry, default, cancellationToken));
 public PythonAnalyzerEntry(EmptyAnalysis emptyAnalysis) : this(emptyAnalysis.Document, emptyAnalysis)
 {
     _bufferVersion = -1;
 }