diff --git a/src/GitHub.InlineReviews/GitHub.InlineReviews.csproj b/src/GitHub.InlineReviews/GitHub.InlineReviews.csproj index 43b7c51e7a..03a9bc2e72 100644 --- a/src/GitHub.InlineReviews/GitHub.InlineReviews.csproj +++ b/src/GitHub.InlineReviews/GitHub.InlineReviews.csproj @@ -90,6 +90,12 @@ + + ShowInlineAnnotationGlyph.xaml + + + ShowInlineCommentAnnotationGlyph.xaml + @@ -228,6 +234,14 @@ Designer true + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + Designer MSBuild:Compile diff --git a/src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs b/src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs index f43c3265ea..4dc28ea4b6 100644 --- a/src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs +++ b/src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs @@ -59,7 +59,22 @@ static UserControl CreateGlyph(InlineCommentTag tag) if (showTag != null) { - return new ShowInlineCommentGlyph(); + if (showTag.Thread != null && showTag.Annotations != null) + { + return new ShowInlineCommentAnnotationGlyph(); + } + + if (showTag.Thread != null) + { + return new ShowInlineCommentGlyph(); + } + + if (showTag.Annotations != null) + { + return new ShowInlineAnnotationGlyph(); + } + + throw new ArgumentException($"{nameof(showTag)} does not have a thread or annotations"); } throw new ArgumentException($"Unknown 'InlineCommentTag' type '{tag}'"); diff --git a/src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs b/src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs index d3e5d651b3..e1422fda3d 100644 --- a/src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs +++ b/src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs @@ -127,10 +127,26 @@ public IEnumerable> GetTags(NormalizedSnapshotSpanCol { linesWithTags[line - startLine] = true; + CheckAnnotationLevel? summaryAnnotationLevel = null; + if (annotations != null) + { + var hasFailure = annotations.Any(model => model.AnnotationLevel == CheckAnnotationLevel.Failure); + if (hasFailure) + { + summaryAnnotationLevel = CheckAnnotationLevel.Failure; + } + else + { + var hasWarning = annotations.Any(model => model.AnnotationLevel == CheckAnnotationLevel.Warning); + summaryAnnotationLevel = hasWarning ? CheckAnnotationLevel.Warning : CheckAnnotationLevel.Notice; + } + } + var showInlineTag = new ShowInlineCommentTag(currentSession, line, thread?.DiffLineType ?? DiffChangeType.Add) { Thread = thread, - Annotations = annotations + Annotations = annotations, + SummaryAnnotationLevel = summaryAnnotationLevel, }; result.Add(new TagSpan( diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml b/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml new file mode 100644 index 0000000000..1eae97fa11 --- /dev/null +++ b/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml.cs b/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml.cs new file mode 100644 index 0000000000..08f998aaf0 --- /dev/null +++ b/src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml.cs @@ -0,0 +1,13 @@ +using System; +using System.Windows.Controls; + +namespace GitHub.InlineReviews.Tags +{ + public partial class ShowInlineAnnotationGlyph : UserControl + { + public ShowInlineAnnotationGlyph() + { + InitializeComponent(); + } + } +} diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml b/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml new file mode 100644 index 0000000000..000ca77afe --- /dev/null +++ b/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml.cs b/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml.cs new file mode 100644 index 0000000000..1523f19280 --- /dev/null +++ b/src/GitHub.InlineReviews/Tags/ShowInlineCommentAnnotationGlyph.xaml.cs @@ -0,0 +1,13 @@ +using System; +using System.Windows.Controls; + +namespace GitHub.InlineReviews.Tags +{ + public partial class ShowInlineCommentAnnotationGlyph : UserControl + { + public ShowInlineCommentAnnotationGlyph() + { + InitializeComponent(); + } + } +} diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml b/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml index 1e0add5448..af262d60d6 100644 --- a/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml +++ b/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml @@ -17,17 +17,13 @@ - - - - - + StrokeThickness="1" /> diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs b/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs index 50dd329d61..0bae7c2d9b 100644 --- a/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs +++ b/src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml.cs @@ -9,6 +9,5 @@ public ShowInlineCommentGlyph() { InitializeComponent(); } - } } diff --git a/src/GitHub.InlineReviews/Tags/ShowInlineCommentTag.cs b/src/GitHub.InlineReviews/Tags/ShowInlineCommentTag.cs index ab72d05db3..6c384ad014 100644 --- a/src/GitHub.InlineReviews/Tags/ShowInlineCommentTag.cs +++ b/src/GitHub.InlineReviews/Tags/ShowInlineCommentTag.cs @@ -31,5 +31,10 @@ public ShowInlineCommentTag(IPullRequestSession session, int lineNumber, DiffCha /// Gets a list of models holding details of the annotations at the tagged line. /// public IReadOnlyList Annotations { get; set; } + + /// + /// Gets a summary annotation level is Annotations are present + /// + public CheckAnnotationLevel? SummaryAnnotationLevel { get; set; } } } diff --git a/src/GitHub.VisualStudio.UI/Styles/VsBrush.xaml b/src/GitHub.VisualStudio.UI/Styles/VsBrush.xaml index 1e965a6910..8580f00010 100644 --- a/src/GitHub.VisualStudio.UI/Styles/VsBrush.xaml +++ b/src/GitHub.VisualStudio.UI/Styles/VsBrush.xaml @@ -17,6 +17,10 @@ + + + +