コード例 #1
0
 public InlineCommentGlyphFactory(
     IInlineCommentPeekService peekService,
     ITextView textView)
 {
     this.peekService = peekService;
     this.textView    = textView;
 }
コード例 #2
0
        public PullRequestEditorService(
            IGitHubServiceProvider serviceProvider,
            IPullRequestService pullRequestService,
            IVsEditorAdaptersFactoryService vsEditorAdaptersFactory,
            IStatusBarNotificationService statusBar,
            IGoToSolutionOrPullRequestFileCommand goToSolutionOrPullRequestFileCommand,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            IMessageDraftStore draftStore,
            IInlineCommentPeekService peekService,
            IUsageTracker usageTracker)
        {
            Guard.ArgumentNotNull(serviceProvider, nameof(serviceProvider));
            Guard.ArgumentNotNull(pullRequestService, nameof(pullRequestService));
            Guard.ArgumentNotNull(vsEditorAdaptersFactory, nameof(vsEditorAdaptersFactory));
            Guard.ArgumentNotNull(statusBar, nameof(statusBar));
            Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(goToSolutionOrPullRequestFileCommand));
            Guard.ArgumentNotNull(goToSolutionOrPullRequestFileCommand, nameof(editorOptionsFactoryService));
            Guard.ArgumentNotNull(usageTracker, nameof(usageTracker));
            Guard.ArgumentNotNull(peekService, nameof(peekService));
            Guard.ArgumentNotNull(draftStore, nameof(draftStore));

            this.serviceProvider         = serviceProvider;
            this.pullRequestService      = pullRequestService;
            this.vsEditorAdaptersFactory = vsEditorAdaptersFactory;
            this.statusBar = statusBar;
            this.goToSolutionOrPullRequestFileCommand = goToSolutionOrPullRequestFileCommand;
            this.editorOptionsFactoryService          = editorOptionsFactoryService;
            this.draftStore   = draftStore;
            this.peekService  = peekService;
            this.usageTracker = usageTracker;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InlineCommentPeekViewModel"/> class.
        /// </summary>
        public InlineCommentPeekViewModel(
            IInlineCommentPeekService peekService,
            IPeekSession peekSession,
            IPullRequestSessionManager sessionManager,
            INextInlineCommentCommand nextCommentCommand,
            IPreviousInlineCommentCommand previousCommentCommand)
        {
            Guard.ArgumentNotNull(peekService, nameof(peekService));
            Guard.ArgumentNotNull(peekSession, nameof(peekSession));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(nextCommentCommand, nameof(nextCommentCommand));
            Guard.ArgumentNotNull(previousCommentCommand, nameof(previousCommentCommand));

            this.peekService    = peekService;
            this.peekSession    = peekSession;
            this.sessionManager = sessionManager;
            triggerPoint        = peekSession.GetTriggerPoint(peekSession.TextView.TextBuffer);

            peekSession.Dismissed += (s, e) => Dispose();

            NextComment = ReactiveCommand.CreateAsyncTask(
                Observable.Return(nextCommentCommand.Enabled),
                _ => nextCommentCommand.Execute(new InlineCommentNavigationParams
            {
                FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
            }));

            PreviousComment = ReactiveCommand.CreateAsyncTask(
                Observable.Return(previousCommentCommand.Enabled),
                _ => previousCommentCommand.Execute(new InlineCommentNavigationParams
            {
                FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
            }));
        }
コード例 #4
0
 protected PreviousInlineCommentCommand(
     IGitHubServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService)
     : base(serviceProvider, tagAggregatorFactory, peekService, CommandSet, CommandId)
 {
 }
コード例 #5
0
ファイル: InlineCommentMargin.cs プロジェクト: ehmz11/aaa
        public InlineCommentMargin(
            IWpfTextViewHost wpfTextViewHost,
            IInlineCommentPeekService peekService,
            IEditorFormatMapService editorFormatMapService,
            IViewTagAggregatorFactoryService tagAggregatorFactory,
            Lazy <IPullRequestSessionManager> sessionManager)
        {
            textView            = wpfTextViewHost.TextView;
            this.sessionManager = sessionManager.Value;

            // Default to not show comment margin
            textView.Options.SetOptionValue(InlineCommentTextViewOptions.MarginEnabledId, false);

            marginGrid = new GlyphMarginGrid {
                Width = 17.0
            };
            var glyphFactory    = new InlineCommentGlyphFactory(peekService, textView);
            var editorFormatMap = editorFormatMapService.GetEditorFormatMap(textView);

            glyphMargin = new GlyphMargin <InlineCommentTag>(textView, glyphFactory, marginGrid, tagAggregatorFactory,
                                                             editorFormatMap, MarginPropertiesName);

            if (IsDiffView())
            {
                TrackCommentGlyph(wpfTextViewHost, marginGrid);
            }

            currentSessionSubscription = this.sessionManager.WhenAnyValue(x => x.CurrentSession)
                                         .Subscribe(x => RefreshCurrentSession().Forget());

            visibleSubscription = marginGrid.WhenAnyValue(x => x.IsVisible)
                                  .Subscribe(x => textView.Options.SetOptionValue(InlineCommentTextViewOptions.MarginVisibleId, x));

            textView.Options.OptionChanged += (s, e) => RefreshMarginVisibility();
        }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineCommentNavigationCommand"/> class.
 /// </summary>
 /// <param name="tagAggregatorFactory">The tag aggregator factory.</param>
 /// <param name="peekService">The peek service.</param>
 /// <param name="commandSet">The GUID of the group the command belongs to.</param>
 /// <param name="commandId">The numeric identifier of the command.</param>
 protected InlineCommentNavigationCommand(
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService,
     Guid commandSet,
     int commandId)
     : base(commandSet, commandId)
 {
     this.tagAggregatorFactory = tagAggregatorFactory;
     this.peekService          = peekService;
 }
コード例 #7
0
        public InlineCommentGlyphFactory(
            IInlineCommentPeekService peekService,
            ITextView textView,
            IEditorFormatMap editorFormatMap)
        {
            this.peekService = peekService;
            this.textView    = textView;

            brushesManager = new BrushesManager(editorFormatMap);
        }
コード例 #8
0
 public InlineCommentMarginProvider(
     IGitHubServiceProvider serviceProvider,
     IEditorFormatMapService editorFormatMapService,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService)
 {
     this.editorFormatMapService = editorFormatMapService;
     this.tagAggregatorFactory   = tagAggregatorFactory;
     this.peekService            = peekService;
     sessionManager = new Lazy <IPullRequestSessionManager>(() => serviceProvider.GetService <IPullRequestSessionManager>());
 }
 public InlineCommentPeekableItemSource(
     IInlineCommentPeekService peekService,
     IPullRequestSessionManager sessionManager,
     INextInlineCommentCommand nextCommentCommand,
     IPreviousInlineCommentCommand previousCommentCommand)
 {
     this.peekService            = peekService;
     this.sessionManager         = sessionManager;
     this.nextCommentCommand     = nextCommentCommand;
     this.previousCommentCommand = previousCommentCommand;
 }
コード例 #10
0
 public InlineCommentMarginProvider(
     IEditorFormatMapService editorFormatMapService,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService,
     IPullRequestSessionManager sessionManager)
 {
     this.editorFormatMapService = editorFormatMapService;
     this.tagAggregatorFactory   = tagAggregatorFactory;
     this.peekService            = peekService;
     this.sessionManager         = sessionManager;
 }
コード例 #11
0
 public InlineCommentPeekableItemSourceProvider(
     IApiClientFactory apiClientFactory,
     IInlineCommentPeekService peekService,
     IPullRequestSessionManager sessionManager,
     INextInlineCommentCommand nextCommentCommand,
     IPreviousInlineCommentCommand previousCommentCommand)
 {
     this.apiClientFactory       = apiClientFactory;
     this.peekService            = peekService;
     this.sessionManager         = sessionManager;
     this.nextCommentCommand     = nextCommentCommand;
     this.previousCommentCommand = previousCommentCommand;
 }
コード例 #12
0
 public InlineCommentMarginProvider(
     IGitHubServiceProvider serviceProvider,
     IEditorFormatMapService editorFormatMapService,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService,
     IPackageSettings packageSettings)
 {
     this.serviceProvider        = serviceProvider;
     this.editorFormatMapService = editorFormatMapService;
     this.tagAggregatorFactory   = tagAggregatorFactory;
     this.peekService            = peekService;
     this.packageSettings        = packageSettings;
 }
コード例 #13
0
 public InlineCommentPeekableItemSourceProvider(
     IInlineCommentPeekService peekService,
     IPullRequestSessionManager sessionManager,
     INextInlineCommentCommand nextCommentCommand,
     IPreviousInlineCommentCommand previousCommentCommand,
     IViewViewModelFactory factory)
 {
     this.peekService            = peekService;
     this.sessionManager         = sessionManager;
     this.nextCommentCommand     = nextCommentCommand;
     this.previousCommentCommand = previousCommentCommand;
     this.factory = factory;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InlineCommentNavigationCommand"/> class.
 /// </summary>
 /// <param name="serviceProvider"></param>
 /// <param name="tagAggregatorFactory">The tag aggregator factory.</param>
 /// <param name="peekService">The peek service.</param>
 /// <param name="commandSet">The GUID of the group the command belongs to.</param>
 /// <param name="commandId">The numeric identifier of the command.</param>
 protected InlineCommentNavigationCommand(
     IGitHubServiceProvider serviceProvider,
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService,
     Guid commandSet,
     int commandId)
     : base(commandSet, commandId)
 {
     this.serviceProvider      = serviceProvider;
     this.tagAggregatorFactory = tagAggregatorFactory;
     this.peekService          = peekService;
     BeforeQueryStatus        += QueryStatus;
 }
コード例 #15
0
        public InlineCommentTaggerProvider(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            IPullRequestSessionManager sessionManager,
            IInlineCommentPeekService peekService)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(peekService, nameof(peekService));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.sessionManager = sessionManager;
            this.peekService    = peekService;
        }
コード例 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InlineCommentPeekViewModel"/> class.
        /// </summary>
        public InlineCommentPeekViewModel(IInlineCommentPeekService peekService,
                                          IPeekSession peekSession,
                                          IPullRequestSessionManager sessionManager,
                                          INextInlineCommentCommand nextCommentCommand,
                                          IPreviousInlineCommentCommand previousCommentCommand,
                                          IViewViewModelFactory factory)
        {
            Guard.ArgumentNotNull(peekService, nameof(peekService));
            Guard.ArgumentNotNull(peekSession, nameof(peekSession));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(nextCommentCommand, nameof(nextCommentCommand));
            Guard.ArgumentNotNull(previousCommentCommand, nameof(previousCommentCommand));
            Guard.ArgumentNotNull(factory, nameof(factory));

            this.peekService    = peekService;
            this.peekSession    = peekSession;
            this.sessionManager = sessionManager;
            this.factory        = factory;
            triggerPoint        = peekSession.GetTriggerPoint(peekSession.TextView.TextBuffer);

            peekSession.Dismissed += (s, e) => Dispose();

            Close = this.WhenAnyValue(x => x.Thread)
                    .Where(x => x != null)
                    .SelectMany(x => x.IsNewThread
                    ? x.Comments.Single().CancelEdit.SelectUnit()
                    : Observable.Never <Unit>());

            NextComment = ReactiveCommand.CreateFromTask(
                () => nextCommentCommand.Execute(new InlineCommentNavigationParams
            {
                FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
            }),
                Observable.Return(nextCommentCommand.Enabled));

            PreviousComment = ReactiveCommand.CreateFromTask(
                () => previousCommentCommand.Execute(new InlineCommentNavigationParams
            {
                FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
            }),
                Observable.Return(previousCommentCommand.Enabled));
        }
コード例 #17
0
        public InlineCommentTagger(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            ITextView view,
            ITextBuffer buffer,
            IPullRequestSessionManager sessionManager,
            IInlineCommentPeekService peekService)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(diffService, nameof(diffService));
            Guard.ArgumentNotNull(buffer, nameof(buffer));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(peekService, nameof(peekService));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.buffer         = buffer;
            this.view           = view;
            this.sessionManager = sessionManager;
            this.peekService    = peekService;

            trackingPoints = new Dictionary <IInlineCommentThreadModel, ITrackingPoint>();

            if (view.Options.GetOptionValue("Tabs/ConvertTabsToSpaces", false))
            {
                tabsToSpaces = view.Options.GetOptionValue <int?>("Tabs/TabSize", null);
            }

            signalRebuild = new Subject <ITextSnapshot>();
            signalRebuild.Throttle(TimeSpan.FromMilliseconds(500))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => Rebuild(x).Forget());

            this.buffer.Changed += Buffer_Changed;
        }
コード例 #18
0
        public InlineCommentTagger(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            ITextView view,
            ITextBuffer buffer,
            IPullRequestSessionManager sessionManager,
            IInlineCommentPeekService peekService)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(diffService, nameof(diffService));
            Guard.ArgumentNotNull(buffer, nameof(buffer));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(peekService, nameof(peekService));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.buffer         = buffer;
            this.view           = view;
            this.sessionManager = sessionManager;
            this.peekService    = peekService;
        }
コード例 #19
0
 public PreviousInlineCommentCommand(
     IViewTagAggregatorFactoryService tagAggregatorFactory,
     IInlineCommentPeekService peekService)
     : base(tagAggregatorFactory, peekService, CommandSet, CommandId)
 {
 }