async Task IBackgroundParserSyntaxTreeHandler.OnSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { // TODO: Only safe to clear error list if each tagger has its own ErrorListHelper. _errorListHelper.Clear(); await InvalidateTags(snapshotSyntaxTree, cancellationToken); }
public async Task Initialize() { await Task.Run(async () => { var snapshot = _textBuffer.CurrentSnapshot; var snapshotSyntaxTree = new SnapshotSyntaxTree(snapshot, snapshot.GetSyntaxTree(CancellationToken.None)); await InvalidateTargets(snapshotSyntaxTree, CancellationToken.None); }); }
private async Task RaiseSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { foreach (var handlerList in _syntaxTreeAvailableEventHandlers) { foreach (var handler in handlerList.Value) { await handler.OnSyntaxTreeAvailable(snapshotSyntaxTree, cancellationToken); } } }
private async Task InvalidateTargets(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { var navigationTargets = new List<EditorTypeNavigationTarget>(); var navigationTargetsVisitor = new NavigationTargetsVisitor(snapshotSyntaxTree.Snapshot, _glyphService, cancellationToken); await Task.Run(() => navigationTargets.AddRange(navigationTargetsVisitor.GetTargets((CompilationUnitSyntax) snapshotSyntaxTree.SyntaxTree.Root)), cancellationToken); _navigationTargets = navigationTargets; OnNavigationTargetsChanged(EventArgs.Empty); }
protected override Tuple<ITextSnapshot, List<ITagSpan<IErrorTag>>> GetTags(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { if (!_errorReportingEnabled) return Tuple.Create(snapshotSyntaxTree.Snapshot, new List<ITagSpan<IErrorTag>>()); var syntaxTree = snapshotSyntaxTree.SyntaxTree; var snapshot = snapshotSyntaxTree.Snapshot; var tagSpans = syntaxTree.GetDiagnostics() .Select(d => CreateTagSpan(snapshot, d, _squigglesEnabled)) .Where(x => x != null) .ToList(); return Tuple.Create(snapshot, tagSpans); }
async Task IBackgroundParserSyntaxTreeHandler.OnSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { await InvalidateTargets(snapshotSyntaxTree, cancellationToken); }
private async Task RaiseSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { foreach (var handlerList in _syntaxTreeAvailableEventHandlers) foreach (var handler in handlerList.Value) await handler.OnSyntaxTreeAvailable(snapshotSyntaxTree, cancellationToken); }
public override Task InvalidateTags(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken) { _latestSnapshotSyntaxTree = snapshotSyntaxTree; return base.InvalidateTags(snapshotSyntaxTree, cancellationToken); }