Esempio n. 1
0
 public Server()
 {
     _queue = new AnalysisQueue();
     _queue.UnhandledException += Analysis_UnhandledException;
     _pendingAnalysisEnqueue    = new VolatileCounter();
     _parseQueue   = new ParseQueue();
     _pendingParse = new Dictionary <IDocument, VolatileCounter>();
     _openFiles    = new OpenFiles(_projectFiles, this);
 }
Esempio n. 2
0
 public Server()
 {
     _queue = new AnalysisQueue();
     _queue.UnhandledException += Analysis_UnhandledException;
     _pendingAnalysisEnqueue    = new VolatileCounter();
     _parseQueue   = new ParseQueue();
     _pendingParse = new Dictionary <IDocument, VolatileCounter>();
     _openFiles    = new OpenFiles(_projectFiles, this);
     _extensions   = new ConcurrentDictionary <string, ILanguageServerExtension>();
 }
Esempio n. 3
0
 public Server()
 {
     _queue = new AnalysisQueue();
     _pendingAnalysisEnqueue  = new VolatileCounter();
     _parseQueue              = new ParseQueue();
     _pendingParse            = new Dictionary <IDocument, VolatileCounter>();
     _projectFiles            = new ConcurrentDictionary <Uri, IProjectEntry>();
     _pendingChanges          = new ConcurrentDictionary <Uri, List <DidChangeTextDocumentParams> >(UriEqualityComparer.IncludeFragment);
     _lastReportedDiagnostics = new ConcurrentDictionary <Uri, Dictionary <int, int> >();
 }
Esempio n. 4
0
        private IDisposable GetDocumentParseCounter(IDocument doc, out int count)
        {
            VolatileCounter counter;

            lock (_pendingParse) {
                if (!_pendingParse.TryGetValue(doc, out counter))
                {
                    _pendingParse[doc] = counter = new VolatileCounter();
                    // Automatically remove counter from the dictionary when it reaches zero.
                    counter.WaitForChangeToZeroAsync().ContinueWith(t => RemoveDocumentParseCounter(t, doc, counter));
                }
                var res = counter.Incremented();
                count = counter.Count;
                return(res);
            }
        }
Esempio n. 5
0
 private void RemoveDocumentParseCounter(Task t, IDocument doc, VolatileCounter counter)
 {
     if (t.IsCompleted)
     {
         lock (_pendingParse) {
             if (counter.IsZero)
             {
                 if (_pendingParse.TryGetValue(doc, out var existing) && existing == counter)
                 {
                     _pendingParse.Remove(doc);
                 }
                 return;
             }
         }
     }
     counter.WaitForChangeToZeroAsync().ContinueWith(t2 => RemoveDocumentParseCounter(t, doc, counter));
 }
Esempio n. 6
0
 public ParseQueue()
 {
     _parsingInProgress = new VolatileCounter();
     _parsing           = new ConcurrentDictionary <Uri, ParseTask>();
 }