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

Commit 050d4d6

Browse files
Merge branch 'master' into refactor/new-metrics-format
# Conflicts: # src/GitHub.VisualStudio/Services/UsageTrackerDispatcher.cs
2 parents c30b240 + 5321090 commit 050d4d6

File tree

113 files changed

+1678
-1698
lines changed

Some content is hidden

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

113 files changed

+1678
-1698
lines changed

GitHubVS.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.InlineReviews.UnitTe
104104
EndProject
105105
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Logging", "src\GitHub.Logging\GitHub.Logging.csproj", "{8D73575A-A89F-47CC-B153-B47DD06837F0}"
106106
EndProject
107+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Services.Vssdk", "src\GitHub.Services.Vssdk\GitHub.Services.Vssdk.csproj", "{2D3D2834-33BE-45CA-B3CC-12F853557D7B}"
108+
EndProject
107109
Global
108110
GlobalSection(SolutionConfigurationPlatforms) = preSolution
109111
Debug|Any CPU = Debug|Any CPU
@@ -403,6 +405,16 @@ Global
403405
{8D73575A-A89F-47CC-B153-B47DD06837F0}.Release|Any CPU.Build.0 = Release|Any CPU
404406
{8D73575A-A89F-47CC-B153-B47DD06837F0}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
405407
{8D73575A-A89F-47CC-B153-B47DD06837F0}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
408+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
409+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
410+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.DebugCodeAnalysis|Any CPU.ActiveCfg = DebugCodeAnalysis|Any CPU
411+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.DebugCodeAnalysis|Any CPU.Build.0 = DebugCodeAnalysis|Any CPU
412+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.DebugWithoutVsix|Any CPU.ActiveCfg = DebugCodeAnalysis|Any CPU
413+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.DebugWithoutVsix|Any CPU.Build.0 = DebugCodeAnalysis|Any CPU
414+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
415+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.Release|Any CPU.Build.0 = Release|Any CPU
416+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
417+
{2D3D2834-33BE-45CA-B3CC-12F853557D7B}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
406418
EndGlobalSection
407419
GlobalSection(SolutionProperties) = preSolution
408420
HideSolutionNode = FALSE

src/GitHub.App/GitHub.App.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@
311311
<Project>{8d73575a-a89f-47cc-b153-b47dd06837f0}</Project>
312312
<Name>GitHub.Logging</Name>
313313
</ProjectReference>
314+
<ProjectReference Include="..\GitHub.Services.Vssdk\GitHub.Services.Vssdk.csproj">
315+
<Project>{2D3D2834-33BE-45CA-B3CC-12F853557D7B}</Project>
316+
<Name>GitHub.Services.Vssdk</Name>
317+
</ProjectReference>
314318
<ProjectReference Include="..\GitHub.UI.Reactive\GitHub.UI.Reactive.csproj">
315319
<Project>{158b05e8-fdbc-4d71-b871-c96e28d5adf5}</Project>
316320
<Name>GitHub.UI.Reactive</Name>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3+
using System.Windows.Markup;
34

45
[assembly: AssemblyTitle("GitHub.App")]
56
[assembly: AssemblyDescription("Provides the view models for the GitHub for Visual Studio extension")]
67
[assembly: Guid("a8b9a236-d238-4733-b116-716872a1e8e0")]
8+
9+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.SampleData")]
10+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels")]
11+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.Dialog")]
12+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.GitHubPane")]

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.ComponentModel.Composition;
3+
using System.ComponentModel.Design;
34
using System.Linq;
45
using System.Reactive;
56
using System.Reactive.Linq;
@@ -15,6 +16,7 @@
1516
using GitHub.Models;
1617
using GitHub.Primitives;
1718
using GitHub.Services;
19+
using GitHub.Services.Vssdk.Commands;
1820
using GitHub.VisualStudio;
1921
using ReactiveUI;
2022
using Serilog;
@@ -36,8 +38,6 @@ public sealed class GitHubPaneViewModel : ViewModelBase, IGitHubPaneViewModel, I
3638
readonly ISimpleApiClientFactory apiClientFactory;
3739
readonly IConnectionManager connectionManager;
3840
readonly ITeamExplorerContext teamExplorerContext;
39-
readonly IVisualStudioBrowser browser;
40-
readonly IUsageTracker usageTracker;
4141
readonly INavigationViewModel navigator;
4242
readonly ILoggedOutViewModel loggedOut;
4343
readonly INotAGitHubRepositoryViewModel notAGitHubRepository;
@@ -49,6 +49,7 @@ public sealed class GitHubPaneViewModel : ViewModelBase, IGitHubPaneViewModel, I
4949
readonly ReactiveCommand<Unit> refresh;
5050
readonly ReactiveCommand<Unit> showPullRequests;
5151
readonly ReactiveCommand<object> openInBrowser;
52+
readonly ReactiveCommand<object> help;
5253
Task initializeTask;
5354
IViewModel content;
5455
ILocalRepositoryModel localRepository;
@@ -82,8 +83,6 @@ public GitHubPaneViewModel(
8283
this.apiClientFactory = apiClientFactory;
8384
this.connectionManager = connectionManager;
8485
this.teamExplorerContext = teamExplorerContext;
85-
this.browser = browser;
86-
this.usageTracker = usageTracker;
8786
this.navigator = navigator;
8887
this.loggedOut = loggedOut;
8988
this.notAGitHubRepository = notAGitHubRepository;
@@ -147,6 +146,13 @@ public GitHubPaneViewModel(
147146
if (url != null) browser.OpenUrl(url);
148147
});
149148

149+
help = ReactiveCommand.Create();
150+
help.Subscribe(_ =>
151+
{
152+
browser.OpenUrl(new Uri(GitHubUrls.Documentation));
153+
usageTracker.IncrementCounter(x => x.NumberOfGitHubPaneHelpClicks).Forget();
154+
});
155+
150156
navigator.WhenAnyObservable(x => x.Content.NavigationRequested)
151157
.Subscribe(x => NavigateTo(x).Forget());
152158

@@ -280,47 +286,27 @@ async Task CreateInitializeTask(IServiceProvider paneServiceProvider)
280286
{
281287
await UpdateContent(teamExplorerContext.ActiveRepository);
282288
teamExplorerContext.WhenAnyValue(x => x.ActiveRepository)
283-
.Skip(1)
284-
.ObserveOn(RxApp.MainThreadScheduler)
285-
.Subscribe(x => UpdateContent(x).Forget());
289+
.Skip(1)
290+
.ObserveOn(RxApp.MainThreadScheduler)
291+
.Subscribe(x => UpdateContent(x).Forget());
286292

287293
connectionManager.Connections.CollectionChanged += (_, __) => UpdateContent(LocalRepository).Forget();
288294

289-
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.pullRequestCommand, showPullRequests);
290-
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.backCommand, navigator.NavigateBack);
291-
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.forwardCommand, navigator.NavigateForward);
292-
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.refreshCommand, refresh);
293-
BindNavigatorCommand(paneServiceProvider, PkgCmdIDList.githubCommand, openInBrowser);
294-
295-
paneServiceProvider.AddCommandHandler(Guids.guidGitHubToolbarCmdSet, PkgCmdIDList.helpCommand,
296-
(_, __) =>
297-
{
298-
browser.OpenUrl(new Uri(GitHubUrls.Documentation));
299-
usageTracker.IncrementCounter(x => x.NumberOfGitHubPaneHelpClicks).Forget();
300-
});
295+
var menuService = (IMenuCommandService)paneServiceProvider.GetService(typeof(IMenuCommandService));
296+
BindNavigatorCommand(menuService, PkgCmdIDList.pullRequestCommand, showPullRequests);
297+
BindNavigatorCommand(menuService, PkgCmdIDList.backCommand, navigator.NavigateBack);
298+
BindNavigatorCommand(menuService, PkgCmdIDList.forwardCommand, navigator.NavigateForward);
299+
BindNavigatorCommand(menuService, PkgCmdIDList.refreshCommand, refresh);
300+
BindNavigatorCommand(menuService, PkgCmdIDList.githubCommand, openInBrowser);
301+
BindNavigatorCommand(menuService, PkgCmdIDList.helpCommand, help);
301302
}
302303

303-
OleMenuCommand BindNavigatorCommand<T>(IServiceProvider paneServiceProvider, int commandId, ReactiveCommand<T> command)
304+
OleMenuCommand BindNavigatorCommand<T>(IMenuCommandService menu, int commandId, ReactiveCommand<T> command)
304305
{
305-
Guard.ArgumentNotNull(paneServiceProvider, nameof(paneServiceProvider));
306+
Guard.ArgumentNotNull(menu, nameof(menu));
306307
Guard.ArgumentNotNull(command, nameof(command));
307308

308-
Func<bool> canExecute = () => Content == navigator && command.CanExecute(null);
309-
310-
var result = paneServiceProvider.AddCommandHandler(
311-
Guids.guidGitHubToolbarCmdSet,
312-
commandId,
313-
canExecute,
314-
() => command.Execute(null),
315-
true);
316-
317-
Observable.CombineLatest(
318-
this.WhenAnyValue(x => x.Content),
319-
command.CanExecuteObservable,
320-
(c, e) => c == navigator && e)
321-
.Subscribe(x => result.Enabled = x);
322-
323-
return result;
309+
return menu.BindCommand(new CommandID(Guids.guidGitHubToolbarCmdSet, commandId), command);
324310
}
325311

326312
async Task NavigateTo<TViewModel>(Func<TViewModel, Task> initialize, Func<TViewModel, bool> match = null)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
3+
using System.Windows.Markup;
34

45
[assembly: AssemblyTitle("GitHub.Exports.Reactive")]
56
[assembly: AssemblyDescription("GitHub interfaces for mef exports with reactive dependencies")]
67
[assembly: Guid("e4ed0537-d1d9-44b6-9212-3096d7c3f7a1")]
8+
9+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels")]
10+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.Dialog")]
11+
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.ViewModels.GitHubPane")]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace GitHub.Commands
4+
{
5+
/// <summary>
6+
/// Opens the login dialog to add a new connection to Team Explorer.
7+
/// </summary>
8+
public interface IAddConnectionCommand : IVsCommand
9+
{
10+
}
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace GitHub.Commands
4+
{
5+
/// <summary>
6+
/// Opens the blame view for the currently selected text on GitHub.com or an Enterprise
7+
/// instance.
8+
/// </summary>
9+
public interface IBlameLinkCommand : IVsCommand
10+
{
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace GitHub.Commands
4+
{
5+
/// <summary>
6+
/// Copies a link to the clipboard of the currently selected text on GitHub.com or an
7+
/// Enterprise instance.
8+
/// </summary>
9+
public interface ICopyLinkCommand : IVsCommand
10+
{
11+
}
12+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace GitHub.Commands
4+
{
5+
/// <summary>
6+
/// Creates a gist from the currently selected text.
7+
/// </summary>
8+
public interface ICreateGistCommand : IVsCommand
9+
{
10+
}
11+
}

src/GitHub.InlineReviews/Commands/INextInlineCommentCommand.cs renamed to src/GitHub.Exports/Commands/INextInlineCommentCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
2+
using GitHub.Commands;
23

3-
namespace GitHub.InlineReviews.Commands
4+
namespace GitHub.Commands
45
{
56
/// <summary>
67
/// Navigates to and opens the the next inline comment thread in the currently active text view.

0 commit comments

Comments
 (0)