Exemple #1
0
        async Task InitializeLiveFile()
        {
            fileSubscription?.Dispose();
            fileSubscription = null;

            relativePath = sessionManager.GetRelativePath(buffer);

            if (relativePath != null)
            {
                file = await sessionManager.GetLiveFile(relativePath, view, buffer);

                var options = view.Options;
                visibleSubscription =
                    Observable.FromEventPattern <EditorOptionChangedEventArgs>(options, nameof(options.OptionChanged))
                    .Select(_ => Unit.Default)
                    .StartWith(Unit.Default)
                    .Select(x => options.GetOptionValue(InlineCommentTextViewOptions.MarginVisibleId))
                    .DistinctUntilChanged()
                    .Subscribe(VisibleChanged);
            }
            else
            {
                file = null;
            }

            NotifyTagsChanged();
        }
        public async Task Initialize()
        {
            var buffer = peekSession.TextView.TextBuffer;
            var info   = sessionManager.GetTextBufferInfo(buffer);

            if (info != null)
            {
                relativePath = info.RelativePath;
                leftBuffer   = info.IsLeftComparisonBuffer;
                file         = await info.Session.GetFile(relativePath);

                session = info.Session;
                await UpdateThread();
            }
            else
            {
                relativePath = sessionManager.GetRelativePath(buffer);
                file         = await sessionManager.GetLiveFile(relativePath, peekSession.TextView, buffer);
                await SessionChanged(sessionManager.CurrentSession);

                sessionSubscription = sessionManager.WhenAnyValue(x => x.CurrentSession)
                                      .Skip(1)
                                      .Subscribe(x => SessionChanged(x).Forget());
            }

            fileSubscription = file.WhenAnyValue(x => x.InlineCommentThreads).Subscribe(_ => UpdateThread().Forget());
        }
Exemple #3
0
        public async Task Initialize()
        {
            var buffer = peekSession.TextView.TextBuffer;
            var info   = sessionManager.GetTextBufferInfo(buffer);

            if (info != null)
            {
                relativePath = info.RelativePath;
                side         = info.Side ?? DiffSide.Right;
                file         = await info.Session.GetFile(relativePath);

                session = info.Session;
                await UpdateThread();
            }
            else
            {
                relativePath = sessionManager.GetRelativePath(buffer);
                file         = await sessionManager.GetLiveFile(relativePath, peekSession.TextView, buffer);
                await SessionChanged(sessionManager.CurrentSession);

                sessionSubscription = sessionManager.WhenAnyValue(x => x.CurrentSession)
                                      .Skip(1)
                                      .Subscribe(x => SessionChanged(x).Forget());
            }

            fileSubscription?.Dispose();
            fileSubscription = file.LinesChanged.Subscribe(LinesChanged);
        }
Exemple #4
0
        async Task <IPullRequestSessionFile> FindSessionFile()
        {
            await sessionManager.EnsureInitialized();

            var session = sessionManager.CurrentSession;

            if (session == null)
            {
                return(null);
            }

            var relativePath = sessionManager.GetRelativePath(textView.TextBuffer);

            if (relativePath == null)
            {
                return(null);
            }

            return(await session.GetFile(relativePath));
        }
Exemple #5
0
        async Task InitializeLiveFile()
        {
            fileSubscription?.Dispose();
            fileSubscription = null;

            relativePath = sessionManager.GetRelativePath(buffer);

            if (relativePath != null)
            {
                var liveFile = await sessionManager.GetLiveFile(relativePath, view, buffer);

                fileSubscription = liveFile.LinesChanged.Subscribe(LinesChanged);
                file             = liveFile;
            }
            else
            {
                file = null;
            }

            NotifyTagsChanged();
        }