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); }
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()); }
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(); }