コード例 #1
0
        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);
        }
コード例 #2
0
 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);
     });
 }
コード例 #3
0
 private async Task RaiseSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken)
 {
     foreach (var handlerList in _syntaxTreeAvailableEventHandlers)
     {
         foreach (var handler in handlerList.Value)
         {
             await handler.OnSyntaxTreeAvailable(snapshotSyntaxTree, cancellationToken);
         }
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 async Task IBackgroundParserSyntaxTreeHandler.OnSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken)
 {
     await InvalidateTargets(snapshotSyntaxTree, cancellationToken);
 }
コード例 #7
0
 private async Task RaiseSyntaxTreeAvailable(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken)
 {
     foreach (var handlerList in _syntaxTreeAvailableEventHandlers)
         foreach (var handler in handlerList.Value)
             await handler.OnSyntaxTreeAvailable(snapshotSyntaxTree, cancellationToken);
 }
コード例 #8
0
 public override Task InvalidateTags(SnapshotSyntaxTree snapshotSyntaxTree, CancellationToken cancellationToken)
 {
     _latestSnapshotSyntaxTree = snapshotSyntaxTree;
     return base.InvalidateTags(snapshotSyntaxTree, cancellationToken);
 }