コード例 #1
0
        async Task SessionChanged(IPullRequestSession session)
        {
            sessionSubscription?.Dispose();
            this.session = session;

            if (file != null)
            {
                file = null;
                NotifyTagsChanged();
            }

            if (session == null)
            {
                return;
            }

            relativePath = session.GetRelativePath(fullPath);

            if (relativePath == null)
            {
                return;
            }

            var snapshot = buffer.CurrentSnapshot;

            if (leftHandSide)
            {
                // If we're tagging the LHS of a diff, then the snapshot will be the base commit
                // (as you'd expect) but that means that the diff will be empty, so get the RHS
                // snapshot from the view for the comparison.
                var projection = view.TextSnapshot as IProjectionSnapshot;
                snapshot = projection?.SourceSnapshots.Count == 2 ? projection.SourceSnapshots[1] : null;
            }

            if (snapshot == null)
            {
                return;
            }

            var repository      = gitService.GetRepository(session.LocalRepository.LocalPath);
            var isContentSource = !leftHandSide && !(buffer is IProjectionBuffer);

            file = await session.GetFile(relativePath, isContentSource?this : null);

            if (file == null)
            {
                return;
            }

            sessionSubscription = file.WhenAnyValue(x => x.InlineCommentThreads)
                                  .Subscribe(_ => NotifyTagsChanged());

            NotifyTagsChanged();
        }
コード例 #2
0
        async Task SessionChanged(IPullRequestSession session)
        {
            this.session = session;
            fileSubscription?.Dispose();

            if (session == null)
            {
                Thread = null;
                threadSubscription?.Dispose();
                return;
            }

            var relativePath = session.GetRelativePath(fullPath);

            file = await session.GetFile(relativePath);

            fileSubscription = file.WhenAnyValue(x => x.InlineCommentThreads).Subscribe(_ => UpdateThread().Forget());
        }