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); }
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>(); }
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> >(); }
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); } }
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)); }
public ParseQueue() { _parsingInProgress = new VolatileCounter(); _parsing = new ConcurrentDictionary <Uri, ParseTask>(); }