Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/GitHub.InlineReviews/GitHub.InlineReviews.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
<Compile Include="Services\PullRequestSessionManager.cs" />
<Compile Include="Margins\InlineCommentMarginProvider.cs" />
<Compile Include="Services\PullRequestSessionService.cs" />
<Compile Include="Tags\ShowInlineAnnotationGlyph.xaml.cs">
<DependentUpon>ShowInlineAnnotationGlyph.xaml</DependentUpon>
</Compile>
<Compile Include="Tags\ShowInlineCommentAnnotationGlyph.xaml.cs">
<DependentUpon>ShowInlineCommentAnnotationGlyph.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\PullRequestFileMarginViewModel.cs" />
<Compile Include="ViewModels\InlineCommentPeekViewModel.cs" />
<Compile Include="ViewModels\PullRequestStatusViewModel.cs" />
Expand Down Expand Up @@ -228,6 +234,14 @@
<SubType>Designer</SubType>
<ContainsDesignTimeResources>true</ContainsDesignTimeResources>
</Page>
<Page Include="Tags\ShowInlineAnnotationGlyph.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Tags\ShowInlineCommentAnnotationGlyph.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PullRequestFileMarginView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
17 changes: 16 additions & 1 deletion src/GitHub.InlineReviews/Tags/InlineCommentGlyphFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}'");
Expand Down
18 changes: 17 additions & 1 deletion src/GitHub.InlineReviews/Tags/InlineCommentTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,26 @@ public IEnumerable<ITagSpan<InlineCommentTag>> 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<ShowInlineCommentTag>(
Expand Down
51 changes: 51 additions & 0 deletions src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<UserControl x:Class="GitHub.InlineReviews.Tags.ShowInlineAnnotationGlyph"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
xmlns:models="clr-namespace:GitHub.Models;assembly=GitHub.Exports"
mc:Ignorable="d">

<Grid>
<Border Background="{DynamicResource GitHubGlyphMarginCommentableBackground}" BorderThickness="0,0,1,0" />
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,0">
<Canvas Width="16" Height="16">
<Canvas.Resources>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
<Setter Property="Stroke" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
</Style>
</Canvas.Resources>

<Rectangle Width="7"
Height="7"
Canvas.Top="3"
Canvas.Left="2.5"
Stroke="White"
StrokeThickness="1">
<Rectangle.LayoutTransform>
<TransformGroup>
<RotateTransform Angle="-45" />
</TransformGroup>
</Rectangle.LayoutTransform>
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerInfoFill}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SummaryAnnotationLevel}"
Value="Failure">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerFailureFill}"/>
</DataTrigger>
<DataTrigger Binding="{Binding SummaryAnnotationLevel}"
Value="Warning">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerWarningFill}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Canvas>
</Viewbox>
</Grid>
</UserControl>
13 changes: 13 additions & 0 deletions src/GitHub.InlineReviews/Tags/ShowInlineAnnotationGlyph.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Windows.Controls;

namespace GitHub.InlineReviews.Tags
{
public partial class ShowInlineAnnotationGlyph : UserControl
{
public ShowInlineAnnotationGlyph()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<UserControl x:Class="GitHub.InlineReviews.Tags.ShowInlineCommentAnnotationGlyph"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
xmlns:models="clr-namespace:GitHub.Models;assembly=GitHub.Exports"
mc:Ignorable="d">

<Grid>
<Border Background="{DynamicResource GitHubGlyphMarginCommentableBackground}" BorderThickness="0,0,1,0" />
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,0">
<Canvas Width="16" Height="16">
<Canvas.Resources>
<Style TargetType="Path">
<Setter Property="Fill" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
<Setter Property="Stroke" Value="{DynamicResource GitHubDiffGlyphFill.None}" />
</Style>
</Canvas.Resources>

<Ellipse Width="9"
Height="9"
Canvas.Top="4"
Canvas.Left="6"
Fill="#959DA5"
Stroke="White"
StrokeThickness="1" />

<Rectangle Width="7"
Height="7"
Canvas.Top="3.5"
Canvas.Left="1"
Stroke="White"
StrokeThickness="1">
<Rectangle.LayoutTransform>
<TransformGroup>
<RotateTransform Angle="-45" />
</TransformGroup>
</Rectangle.LayoutTransform>
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerInfoFill}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding SummaryAnnotationLevel}"
Value="{x:Static models:CheckAnnotationLevel.Failure}">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerFailureFill}"/>
</DataTrigger>
<DataTrigger Binding="{Binding SummaryAnnotationLevel}"
Value="{x:Static models:CheckAnnotationLevel.Warning}">
<Setter Property="Fill" Value="{DynamicResource GitHubAnnotationMarkerWarningFill}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</Canvas>
</Viewbox>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Windows.Controls;

namespace GitHub.InlineReviews.Tags
{
public partial class ShowInlineCommentAnnotationGlyph : UserControl
{
public ShowInlineCommentAnnotationGlyph()
{
InitializeComponent();
}
}
}
16 changes: 6 additions & 10 deletions src/GitHub.InlineReviews/Tags/ShowInlineCommentGlyph.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@
</Style>
</Canvas.Resources>

<Rectangle Width="8"
Height="8"
Canvas.Top="2.3"
Canvas.Left="2.3"
Fill="#959da5"
<Ellipse Width="9"
Height="9"
Canvas.Top="3.5"
Canvas.Left="3.5"
Fill="#959DA5"
Stroke="White"
StrokeThickness="1">
<Rectangle.LayoutTransform>
<RotateTransform Angle="-45" />
</Rectangle.LayoutTransform>
</Rectangle>
StrokeThickness="1" />
</Canvas>
</Viewbox>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ public ShowInlineCommentGlyph()
{
InitializeComponent();
}

}
}
5 changes: 5 additions & 0 deletions src/GitHub.InlineReviews/Tags/ShowInlineCommentTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
public IReadOnlyList<InlineAnnotationModel> Annotations { get; set; }

/// <summary>
/// Gets a summary annotation level is Annotations are present
/// </summary>
public CheckAnnotationLevel? SummaryAnnotationLevel { get; set; }
}
}
4 changes: 4 additions & 0 deletions src/GitHub.VisualStudio.UI/Styles/VsBrush.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

<SolidColorBrush x:Key="GitHubGlyphMarginCommentableBackground" Color="{DynamicResource VsColor.SearchBoxBackground}" />

<SolidColorBrush x:Key="GitHubAnnotationMarkerInfoFill" Color="#23a1d0" />
<SolidColorBrush x:Key="GitHubAnnotationMarkerWarningFill" Color="#ffc806" />
<SolidColorBrush x:Key="GitHubAnnotationMarkerFailureFill" Color="#d53243" />

<!-- Team Foundation Colors -->
<SolidColorBrush x:Key="TFRequiredTextBoxBorderBrushKey" Color="{Binding Source={x:Static vsui:TeamFoundationColors.Instance}, Path=RequiredTextBoxBorderColor, Mode=OneWay}" />
<SolidColorBrush x:Key="TFTextBoxBorderBrushKey" Color="{Binding Source={x:Static vsui:TeamFoundationColors.Instance}, Path=TextBoxBorderColor, Mode=OneWay}" />
Expand Down