Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit f1bab19

Browse files
authored
Merge branch 'master' into fixes/1908-unicode-error
2 parents 84c37c9 + 82a2ccd commit f1bab19

File tree

121 files changed

+9152
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+9152
-1894
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ProjectConfiguration>
2+
<Settings>
3+
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
4+
</Settings>
5+
</ProjectConfiguration>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ProjectConfiguration>
2+
<Settings>
3+
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
4+
</Settings>
5+
</ProjectConfiguration>

GitHubVS.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Wpf", "submodule
133133
EndProject
134134
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InstallAndStart", "test\Launcher\InstallAndStart.csproj", "{79F32BE1-2764-4DBA-97F6-21053DE44270}"
135135
EndProject
136+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.TeamFoundation.16", "src\GitHub.TeamFoundation.16\GitHub.TeamFoundation.16.csproj", "{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}"
137+
EndProject
136138
Global
137139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
138140
Debug|Any CPU = Debug|Any CPU
@@ -542,6 +544,16 @@ Global
542544
{79F32BE1-2764-4DBA-97F6-21053DE44270}.Release|Any CPU.Build.0 = Release|Any CPU
543545
{79F32BE1-2764-4DBA-97F6-21053DE44270}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
544546
{79F32BE1-2764-4DBA-97F6-21053DE44270}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
547+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
548+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
549+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.DebugCodeAnalysis|Any CPU.ActiveCfg = DebugCodeAnalysis|Any CPU
550+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.DebugCodeAnalysis|Any CPU.Build.0 = DebugCodeAnalysis|Any CPU
551+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.DebugWithoutVsix|Any CPU.ActiveCfg = DebugCodeAnalysis|Any CPU
552+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.DebugWithoutVsix|Any CPU.Build.0 = DebugCodeAnalysis|Any CPU
553+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
554+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.Release|Any CPU.Build.0 = Release|Any CPU
555+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
556+
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
545557
EndGlobalSection
546558
GlobalSection(SolutionProperties) = preSolution
547559
HideSolutionNode = FALSE

GitHubVS.v3.ncrunchsolution

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AdditionalFilesToIncludeForSolution>
88
<Value>lib\**.*</Value>
99
</AdditionalFilesToIncludeForSolution>
10-
<AllowParallelTestExecution>False</AllowParallelTestExecution>
10+
<AllowParallelTestExecution>True</AllowParallelTestExecution>
1111
<ProjectConfigStoragePathRelativeToSolutionDir>.ncrunch</ProjectConfigStoragePathRelativeToSolutionDir>
1212
<SolutionConfigured>True</SolutionConfigured>
1313
</Settings>

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ ignore:
3232
- "*.xaml"
3333
- "*.xaml.cs"
3434
- "**/SampleData/*"
35+
- "src/GitHub.App/sqlite-net/*"
1.39 MB
Binary file not shown.
698 KB
Binary file not shown.
1.09 MB
Binary file not shown.
36.8 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using GitHub.ViewModels;
2+
3+
namespace GitHub.Models.Drafts
4+
{
5+
/// <summary>
6+
/// Stores a draft for a <see cref="CommentViewModel"/>
7+
/// </summary>
8+
public class CommentDraft
9+
{
10+
/// <summary>
11+
/// Gets or sets the draft comment body.
12+
/// </summary>
13+
public string Body { get; set; }
14+
}
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using GitHub.ViewModels.GitHubPane;
2+
3+
namespace GitHub.Models.Drafts
4+
{
5+
/// <summary>
6+
/// Stores a draft for a <see cref="PullRequestCreationViewModel"/>.
7+
/// </summary>
8+
public class PullRequestDraft
9+
{
10+
/// <summary>
11+
/// Gets or sets the draft pull request title.
12+
/// </summary>
13+
public string Title { get; set; }
14+
15+
/// <summary>
16+
/// Gets or sets the draft pull request body.
17+
/// </summary>
18+
public string Body { get; set; }
19+
}
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using GitHub.ViewModels;
3+
4+
namespace GitHub.Models.Drafts
5+
{
6+
/// <summary>
7+
/// Stores a draft for a <see cref="PullRequestReviewCommentViewModel"/>
8+
/// </summary>
9+
public class PullRequestReviewCommentDraft : CommentDraft
10+
{
11+
/// <summary>
12+
/// Gets or sets the side of the diff that the draft comment was left on.
13+
/// </summary>
14+
public DiffSide Side { get; set; }
15+
16+
/// <summary>
17+
/// Gets or sets the time that the draft was last updated.
18+
/// </summary>
19+
public DateTimeOffset UpdatedAt { get; set; }
20+
}
21+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using GitHub.ViewModels.GitHubPane;
2+
3+
namespace GitHub.Models.Drafts
4+
{
5+
/// <summary>
6+
/// Stores a draft for a <see cref="PullRequestReviewAuthoringViewModel"/>.
7+
/// </summary>
8+
public class PullRequestReviewDraft
9+
{
10+
/// <summary>
11+
/// Gets or sets the draft review body.
12+
/// </summary>
13+
public string Body { get; set; }
14+
}
15+
}
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
using System;
2-
using System.Collections.ObjectModel;
3-
using System.Diagnostics.CodeAnalysis;
4-
using System.Reactive;
1+
using System.Diagnostics.CodeAnalysis;
2+
using System.Threading.Tasks;
53
using GitHub.ViewModels;
64
using ReactiveUI;
75

86
namespace GitHub.SampleData
97
{
108
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
11-
public class CommentThreadViewModelDesigner : ICommentThreadViewModel
9+
public class CommentThreadViewModelDesigner : ViewModelBase, ICommentThreadViewModel
1210
{
13-
public ObservableCollection<ICommentViewModel> Comments { get; }
14-
= new ObservableCollection<ICommentViewModel>();
11+
public IReadOnlyReactiveList<ICommentViewModel> Comments { get; }
12+
= new ReactiveList<ICommentViewModel>();
1513

1614
public IActorViewModel CurrentUser { get; set; }
1715
= new ActorViewModel { Login = "shana" };
1816

19-
public ReactiveCommand<string, Unit> PostComment { get; }
20-
public ReactiveCommand<Tuple<string, string>, Unit> EditComment { get; }
21-
public ReactiveCommand<Tuple<int, int>, Unit> DeleteComment { get; }
17+
public Task DeleteComment(ICommentViewModel comment) => Task.CompletedTask;
18+
public Task EditComment(ICommentViewModel comment) => Task.CompletedTask;
19+
public Task PostComment(ICommentViewModel comment) => Task.CompletedTask;
2220
}
2321
}

src/GitHub.App/SampleData/CommentViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public CommentViewModelDesigner()
2424
public bool IsSubmitting { get; set; }
2525
public bool CanDelete { get; } = true;
2626
public ICommentThreadViewModel Thread { get; }
27-
public DateTimeOffset UpdatedAt => DateTime.Now.Subtract(TimeSpan.FromDays(3));
27+
public DateTimeOffset CreatedAt => DateTime.Now.Subtract(TimeSpan.FromDays(3));
2828
public IActorViewModel Author { get; set; }
2929
public Uri WebUrl { get; }
3030

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public PullRequestDetailViewModelDesigner()
9696

9797
Files = new PullRequestFilesViewModelDesigner();
9898

99-
Checks = new PullRequestCheckViewModelDesigner[0];
99+
Checks = Array.Empty<PullRequestCheckViewModelDesigner>();
100100
}
101101

102102
public PullRequestDetailModel Model { get; }

src/GitHub.App/SampleData/PullRequestUserReviewsViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public PullRequestUserReviewsViewModelDesigner()
2727
{
2828
IsExpanded = true,
2929
HasDetails = true,
30-
FileComments = new IPullRequestReviewFileCommentViewModel[0],
30+
FileComments = Array.Empty<IPullRequestReviewFileCommentViewModel>(),
3131
StateDisplay = "approved",
3232
Model = new PullRequestReviewModel
3333
{

src/GitHub.InlineReviews/Services/InlineCommentPeekService.cs renamed to src/GitHub.App/Services/InlineCommentPeekService.cs

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,25 @@
22
using System.ComponentModel.Composition;
33
using System.Linq;
44
using System.Reactive.Linq;
5-
using System.Threading.Tasks;
6-
using GitHub.Api;
75
using GitHub.Extensions;
8-
using GitHub.Factories;
9-
using GitHub.InlineReviews.Peek;
10-
using GitHub.InlineReviews.Tags;
116
using GitHub.Models;
12-
using GitHub.Primitives;
13-
using GitHub.Services;
7+
using GitHub.ViewModels;
148
using Microsoft.VisualStudio.Language.Intellisense;
159
using Microsoft.VisualStudio.Text;
1610
using Microsoft.VisualStudio.Text.Differencing;
1711
using Microsoft.VisualStudio.Text.Editor;
1812
using Microsoft.VisualStudio.Text.Outlining;
1913
using Microsoft.VisualStudio.Text.Projection;
2014

21-
namespace GitHub.InlineReviews.Services
15+
namespace GitHub.Services
2216
{
2317
/// <summary>
2418
/// Shows inline comments in a peek view.
2519
/// </summary>
2620
[Export(typeof(IInlineCommentPeekService))]
2721
class InlineCommentPeekService : IInlineCommentPeekService
2822
{
23+
const string relationship = "GitHubCodeReview";
2924
readonly IOutliningManagerService outliningService;
3025
readonly IPeekBroker peekBroker;
3126
readonly IUsageTracker usageTracker;
@@ -90,69 +85,46 @@ public void Hide(ITextView textView)
9085
}
9186

9287
/// <inheritdoc/>
93-
public ITrackingPoint Show(ITextView textView, AddInlineCommentTag tag)
88+
public ITrackingPoint Show(ITextView textView, DiffSide side, int lineNumber)
9489
{
95-
Guard.ArgumentNotNull(tag, nameof(tag));
96-
97-
var lineAndtrackingPoint = GetLineAndTrackingPoint(textView, tag);
90+
var lineAndtrackingPoint = GetLineAndTrackingPoint(textView, side, lineNumber);
9891
var line = lineAndtrackingPoint.Item1;
9992
var trackingPoint = lineAndtrackingPoint.Item2;
10093
var options = new PeekSessionCreationOptions(
10194
textView,
102-
InlineCommentPeekRelationship.Instance.Name,
95+
relationship,
10396
trackingPoint,
10497
defaultHeight: 0);
10598

10699
ExpandCollapsedRegions(textView, line.Extent);
107100

108101
var session = peekBroker.TriggerPeekSession(options);
109-
var item = session.PeekableItems.OfType<InlineCommentPeekableItem>().FirstOrDefault();
110-
item?.ViewModel.Close.Take(1).Subscribe(_ => session.Dismiss());
111-
112-
return trackingPoint;
113-
}
114-
115-
/// <inheritdoc/>
116-
public ITrackingPoint Show(ITextView textView, ShowInlineCommentTag tag)
117-
{
118-
Guard.ArgumentNotNull(textView, nameof(textView));
119-
Guard.ArgumentNotNull(tag, nameof(tag));
120-
121-
var lineAndtrackingPoint = GetLineAndTrackingPoint(textView, tag);
122-
var line = lineAndtrackingPoint.Item1;
123-
var trackingPoint = lineAndtrackingPoint.Item2;
124-
var options = new PeekSessionCreationOptions(
125-
textView,
126-
InlineCommentPeekRelationship.Instance.Name,
127-
trackingPoint,
128-
defaultHeight: 0);
129-
130-
ExpandCollapsedRegions(textView, line.Extent);
131-
132-
var session = peekBroker.TriggerPeekSession(options);
133-
var item = session.PeekableItems.OfType<InlineCommentPeekableItem>().FirstOrDefault();
134-
item?.ViewModel.Close.Take(1).Subscribe(_ => session.Dismiss());
135-
102+
var item = session.PeekableItems.OfType<IClosable>().FirstOrDefault();
103+
item?.Closed.Take(1).Subscribe(_ => session.Dismiss());
104+
136105
return trackingPoint;
137106
}
138107

139-
Tuple<ITextSnapshotLine, ITrackingPoint> GetLineAndTrackingPoint(ITextView textView, InlineCommentTag tag)
108+
Tuple<ITextSnapshotLine, ITrackingPoint> GetLineAndTrackingPoint(
109+
ITextView textView,
110+
DiffSide side,
111+
int lineNumber)
140112
{
141113
var diffModel = (textView as IWpfTextView)?.TextViewModel as IDifferenceTextViewModel;
142114
var snapshot = textView.TextSnapshot;
143115

144116
if (diffModel?.ViewType == DifferenceViewType.InlineView)
145117
{
146-
snapshot = tag.DiffChangeType == DiffChangeType.Delete ?
118+
snapshot = side == DiffSide.Left ?
147119
diffModel.Viewer.DifferenceBuffer.LeftBuffer.CurrentSnapshot :
148120
diffModel.Viewer.DifferenceBuffer.RightBuffer.CurrentSnapshot;
149121
}
150122

151-
var line = snapshot.GetLineFromLineNumber(tag.LineNumber);
123+
var line = snapshot.GetLineFromLineNumber(lineNumber);
152124
var trackingPoint = snapshot.CreateTrackingPoint(line.Start.Position, PointTrackingMode.Positive);
153125

154126
ExpandCollapsedRegions(textView, line.Extent);
155-
peekBroker.TriggerPeekSession(textView, trackingPoint, InlineCommentPeekRelationship.Instance.Name);
127+
peekBroker.TriggerPeekSession(textView, trackingPoint, relationship);
156128

157129
usageTracker.IncrementCounter(x => x.NumberOfPRReviewDiffViewInlineCommentOpen).Forget();
158130

src/GitHub.App/Services/ModelService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ IObservable<IReadOnlyList<IRemoteRepositoryModel>> GetUserRepositories(Repositor
320320
log.Error(e,
321321
"Retrieving {RepositoryType} user repositories failed because user is not stored in the cache",
322322
repositoryType);
323-
return Observable.Return(new IRemoteRepositoryModel[] {});
323+
return Observable.Return(Array.Empty<IRemoteRepositoryModel>());
324324
});
325325
}
326326

@@ -355,7 +355,7 @@ IObservable<IReadOnlyList<IRemoteRepositoryModel>> GetOrganizationRepositories(s
355355
{
356356
log.Error(e, "Retrieveing {Organization} org repositories failed because user is not stored in the cache",
357357
organization);
358-
return Observable.Return(new IRemoteRepositoryModel[] {});
358+
return Observable.Return(Array.Empty<IRemoteRepositoryModel>());
359359
});
360360
}
361361

0 commit comments

Comments
 (0)