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

Commit bec5eca

Browse files
committed
Add more xmldocs
1 parent 83610bf commit bec5eca

File tree

7 files changed

+107
-0
lines changed

7 files changed

+107
-0
lines changed

src/GitHub.App/Services/GitHubContextService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace GitHub.Services
2222
{
23+
/// <inheritdoc/>
2324
[Export(typeof(IGitHubContextService))]
2425
public class GitHubContextService : IGitHubContextService
2526
{

src/GitHub.Exports/Commands/IOpenFromClipboardCommand.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
namespace GitHub.Commands
22
{
3+
/// <summary>
4+
/// This command appears as `Code context > GitHub > Open from clipboard`.
5+
///
6+
/// Open a working directory file at the same location as a GitHub URL in the clipboard. If the URL links to
7+
/// a line or range of lines, these lines will be selected. If the working directory file is different to the
8+
/// target file, the target file will be opened in the `Blame (Annotate)` view. If the URL is from a different
9+
/// fork, it will still open the target file assuming that the target commit/branch exists.
10+
/// </summary>
11+
/// <remarks>
12+
/// Currently only GitHub `blob` URLs are supported. In a future version we can add support for `pull`, `issue`,
13+
/// `tree`, `commits`, `blame` and any other URL types that might make sense.
14+
/// </remarks>
315
public interface IOpenFromClipboardCommand : IVsCommand<string>
416
{
517
}

src/GitHub.Exports/Commands/IOpenFromUrlCommand.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
namespace GitHub.Commands
22
{
3+
/// <summary>
4+
/// This appears as the named command `GitHub.OpenFromUrl` and must be bound to a keyboard shortcut or executed
5+
/// via the `Command Window`. In future it will appear on `File > Open > Open from GitHub`.
6+
///
7+
/// When executed it will offer to clone, open and navigate to the file pointed to by a URL in the clipboard.
8+
/// This spike uses Yes/No/Cancel dialogs, but the final version will use a UI to control what action is performed
9+
/// and allow the user to override the default repository location.
10+
/// </summary>
311
public interface IOpenFromUrlCommand : IVsCommand<string>
412
{
513
}

src/GitHub.Exports/Services/IGitHubContextService.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,79 @@ namespace GitHub.Services
55
{
66
public interface IGitHubContextService
77
{
8+
/// <summary>
9+
/// Find the context from a URL in the clipboard if any.
10+
/// </summary>
11+
/// <returns>The context or null if clipboard doesn't contain a GitHub URL</returns>
812
GitHubContext FindContextFromClipboard();
13+
14+
/// <summary>
15+
/// Find the context from the title of the topmost browser.
16+
/// </summary>
17+
/// <returns>A context or null if a context can't be found.</returns>
918
GitHubContext FindContextFromBrowser();
19+
20+
/// <summary>
21+
/// Convert a GitHub URL to a context object.
22+
/// </summary>
23+
/// <param name="url">A GitHub URL</param>
24+
/// <returns>The context from the URL or null</returns>
1025
GitHubContext FindContextFromUrl(string url);
26+
27+
/// <summary>
28+
/// Convert a context to a repository URL.
29+
/// </summary>
30+
/// <param name="context">The context to convert.</param>
31+
/// <returns>A repository URL</returns>
1132
GitHubContext FindContextFromWindowTitle(string windowTitle);
33+
34+
/// <summary>
35+
/// Find a context from a browser window title.
36+
/// </summary>
37+
/// <param name="windowTitle">A browser window title.</param>
38+
/// <returns>The context or null if none can be found</returns>
1239
Uri ToRepositoryUrl(GitHubContext context);
40+
41+
/// <summary>
42+
/// Open a file in the working directory that corresponds to a context and navigate to a line/range.
43+
/// </summary>
44+
/// <param name="repositoryDir">The working directory.</param>
45+
/// <param name="context">A context to navigate to.</param>
46+
/// <returns>True if navigation was successful</returns>
1347
bool TryOpenFile(string repositoryDir, GitHubContext context);
48+
49+
/// <summary>
50+
/// Attempt to open the Blame/Annotate view for a context.
51+
/// </summary>
52+
/// <remarks>
53+
/// The access to the Blame/Annotate view was added in a version of Visual Studio 2017. This method will return
54+
/// false is this functionality isn't available.
55+
/// </remarks>
56+
/// <param name="repositoryDir">The target repository</param>
57+
/// <param name="currentBranch">A branch in the local repository. It isn't displayed on the UI but must exist. It can be a remote or local branch.</param>
58+
/// <param name="context">The context to open.</param>
59+
/// <returns>True if AnnotateFile functionality is available.</returns>
1460
Task<bool> TryAnnotateFile(string repositoryDir, string currentBranch, GitHubContext context);
61+
62+
/// <summary>
63+
/// Map from a context to a repository blob object.
64+
/// </summary>
65+
/// <param name="repositoryDir">The target repository.</param>
66+
/// <param name="context">The context to map from.</param>
67+
/// <param name="remoteName">The name of the remote to search for branches.</param>
68+
/// <returns>The resolved commit-ish, blob path and commit SHA for the blob. Path will be null if the commit-ish can be resolved but not the blob.</returns>
1569
(string commitish, string path, string commitSha) ResolveBlob(string repositoryDir, GitHubContext context, string remoteName = "origin");
70+
71+
/// <summary>
72+
/// Check if a file in the working directory has changed since a specified commit-ish.
73+
/// </summary>
74+
/// <remarks>
75+
/// The commit-ish might be a commit SHA, a tag or a remote branch.
76+
/// </remarks>
77+
/// <param name="repositoryDir">The target repository.</param>
78+
/// <param name="commitish">A commit SHA, remote branch or tag.</param>
79+
/// <param name="path">The path for a blob.</param>
80+
/// <returns>True if the working file is different.</returns>
1681
bool HasChangesInWorkingDirectory(string repositoryDir, string commitish, string path);
1782
}
1883
}

src/GitHub.Exports/Services/IVSServices.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,27 @@ namespace GitHub.Services
44
{
55
public interface IVSServices
66
{
7+
/// <summary>
8+
/// Get the full Visual Studio version from `VisualStudio\14.0_Config\SplashInfo|EnvVersion` on Visual Studoi 2015
9+
/// or `SetupConfiguration.GetInstanceForCurrentProcess()` on on Visual Studoi 2017.
10+
/// </summary>
711
string VSVersion { get; }
12+
13+
/// <summary>Open a repository in Team Explorer</summary>
14+
/// <remarks>
15+
/// There doesn't appear to be a command that directly opens a target repo.
16+
/// Our workaround is to create, open and delete a solution in the repo directory.
17+
/// This triggers an event that causes the target repo to open. ;)
18+
/// </remarks>
19+
/// <param name="repoPath">The path to the repository to open</param>
20+
/// <returns>True if a transient solution was successfully created in target directory (which should trigger opening of repository).</returns>
821
bool TryOpenRepository(string directory);
22+
23+
/// <summary>
24+
/// Displays a message box with the specified message.
25+
/// </summary>
26+
/// <param name="message">The message to display</param>
27+
/// <returns>The result.</returns>
928
VSConstants.MessageBoxResult ShowMessageBoxInfo(string message);
1029
}
1130
}

src/GitHub.VisualStudio/Commands/OpenFromClipboardCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace GitHub.VisualStudio.Commands
1111
{
12+
/// <inheritdoc/>
1213
[Export(typeof(IOpenFromClipboardCommand))]
1314
public class OpenFromClipboardCommand : VsCommand<string>, IOpenFromClipboardCommand
1415
{

src/GitHub.VisualStudio/Commands/OpenFromUrlCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace GitHub.VisualStudio.Commands
1717
{
18+
/// <inheritdoc/>
1819
[Export(typeof(IOpenFromUrlCommand))]
1920
public class OpenFromUrlCommand : VsCommand<string>, IOpenFromUrlCommand
2021
{

0 commit comments

Comments
 (0)