This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,19 @@ namespace GitHub.InlineReviews.Peek
77{
88 class InlineCommentPeekableItem : IPeekableItem
99 {
10- readonly InlineCommentPeekViewModel viewModel ;
11-
1210 public InlineCommentPeekableItem ( InlineCommentPeekViewModel viewModel )
1311 {
14- this . viewModel = viewModel ;
12+ ViewModel = viewModel ;
1513 }
1614
1715 public string DisplayName => "GitHub Code Review" ;
16+ public InlineCommentPeekViewModel ViewModel { get ; }
1817
1918 public IEnumerable < IPeekRelationship > Relationships => new [ ] { InlineCommentPeekRelationship . Instance } ;
2019
2120 public IPeekResultSource GetOrCreateResultSource ( string relationshipName )
2221 {
23- return new InlineCommentPeekableResultSource ( viewModel ) ;
22+ return new InlineCommentPeekableResultSource ( ViewModel ) ;
2423 }
2524 }
2625}
Original file line number Diff line number Diff line change 11using System ;
22using System . ComponentModel . Composition ;
3+ using System . Linq ;
4+ using System . Reactive . Linq ;
35using System . Threading . Tasks ;
46using GitHub . Api ;
57using GitHub . Extensions ;
@@ -96,7 +98,15 @@ public ITrackingPoint Show(ITextView textView, AddInlineCommentTag tag)
9698
9799 ExpandCollapsedRegions ( textView , line . Extent ) ;
98100
99- peekBroker . TriggerPeekSession ( textView , trackingPoint , InlineCommentPeekRelationship . Instance . Name ) ;
101+ var session = peekBroker . TriggerPeekSession ( textView , trackingPoint , InlineCommentPeekRelationship . Instance . Name ) ;
102+ var item = session . PeekableItems . OfType < InlineCommentPeekableItem > ( ) . FirstOrDefault ( ) ;
103+
104+ if ( item != null )
105+ {
106+ var placeholder = item . ViewModel . Thread . Comments . Last ( ) ;
107+ placeholder . CancelEdit . Take ( 1 ) . Subscribe ( _ => session . Dismiss ( ) ) ;
108+ }
109+
100110 return trackingPoint ;
101111 }
102112
You can’t perform that action at this time.
0 commit comments