public TrackingSession(Workspace workspace, IActiveStatementSpanProvider spanProvider)
            {
                _workspace          = workspace;
                _trackingSpans      = new Dictionary <DocumentId, ImmutableArray <ActiveStatementTrackingSpan> >();
                _cancellationSource = new CancellationTokenSource();
                _spanProvider       = spanProvider;

                _workspace.DocumentOpened += DocumentOpened;
                _workspace.DocumentClosed += DocumentClosed;
            }
Beispiel #2
0
        public async ValueTask StartTrackingAsync(Solution solution, IActiveStatementSpanProvider spanProvider, CancellationToken cancellationToken)
        {
            var newSession = new TrackingSession(_workspace, spanProvider);

            if (Interlocked.CompareExchange(ref _session, newSession, null) != null)
            {
                newSession.EndTracking();
                Contract.Fail("Can only track active statements for a single edit session.");
            }

            await newSession.TrackActiveSpansAsync(solution, cancellationToken).ConfigureAwait(false);

            TrackingChanged?.Invoke();
        }
 public ActiveStatementTrackingService(Workspace workspace)
 {
     _workspace    = workspace;
     _spanProvider = new RemoteEditAndContinueServiceProxy(_workspace);
 }