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

Commit c37a57e

Browse files
committed
Add xmldoc comments for NavigationService
1 parent 6b38d26 commit c37a57e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/GitHub.App/Services/NavigationService.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ public IVsTextView FindActiveView()
5656
return hresult == VSConstants.S_OK ? view : null;
5757
}
5858

59+
/// <summary>
60+
/// Find the closest matching line in <see cref="toLines"/>.
61+
/// </summary>
62+
/// <remarks>
63+
/// When matching we prioritize unique matching lines in <see cref="toLines"/>. If the target line isn't
64+
/// unique, continue searching the lines above for a better match and use this as anchor with an offset.
65+
/// The closest match to <see cref="line"/> with the fewest duplicate matches will be used for the matching line.
66+
/// </remarks>
67+
/// <param name="fromLines">The document we're navigating from.</param>
68+
/// <param name="toLines">The document we're navigating to.</param>
69+
/// <param name="line">The 0-based line we're navigating from.</param>
70+
/// <returns>The best matching line in <see cref="toLines"/></returns>
5971
public int FindMatchingLine(IList<string> fromLines, IList<string> toLines, int line)
6072
{
6173
var matchingLine = -1;
@@ -93,6 +105,14 @@ public int FindMatchingLine(IList<string> fromLines, IList<string> toLines, int
93105
return matchingLine;
94106
}
95107

108+
/// <summary>
109+
/// Find the nearest matching line to <see cref="line"/> and the number of similar matched lines in the text.
110+
/// </summary>
111+
/// <param name="fromLines">The document we're navigating from.</param>
112+
/// <param name="toLines">The document we're navigating to.</param>
113+
/// <param name="line">The 0-based line we're navigating from.</param>
114+
/// <param name="matchedLines">The number of similar matched lines in <see cref="toLines"/></param>
115+
/// <returns>Find the nearest matching line in <see cref="toLines"/>.</returns>
96116
public int FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line, out int matchedLines)
97117
{
98118
line = line < fromLines.Count ? line : fromLines.Count - 1; // VS shows one extra line at end

src/GitHub.Exports/Services/INavigationService.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ namespace GitHub.Services
44
{
55
public interface INavigationService
66
{
7+
/// <summary>
8+
/// Find the active text view.
9+
/// </summary>
10+
/// <returns>The active view or null if view can't be found.</returns>
711
IVsTextView FindActiveView();
12+
13+
/// <summary>
14+
/// Navigate to and place the caret at the best guess equivalent position in <see cref="targetFile"/>.
15+
/// </summary>
16+
/// <param name="sourceView">The text view to navigate from.</param>
17+
/// <param name="targetFile">The text view to open and navigate to.</param>
18+
/// <returns>The opened text view.</returns>
819
IVsTextView NavigateToEquivalentPosition(IVsTextView sourceView, string targetFile);
920
}
1021
}

0 commit comments

Comments
 (0)