Skip to content

Commit

Permalink
Improve selecting a method
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir Boulema committed Sep 13, 2022
1 parent 89f5886 commit 67ae1ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CodeNav.Shared/Mappers/BaseMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@ private static LinePosition GetEndLinePosition(SyntaxNode source) =>
source.SyntaxTree.GetLineSpan(source.Span).EndLinePosition;

private static int GetStartLine(SyntaxNode source) =>
source.SyntaxTree.GetLineSpan(source.Span).StartLinePosition.Line + 1;
GetStartLinePosition(source).Line + 1;

private static int GetEndLine(SyntaxNode source) =>
source.SyntaxTree.GetLineSpan(source.Span).EndLinePosition.Line + 1;
GetEndLinePosition(source).Line + 1;

public static LinePosition GetStartLinePosition(SyntaxToken identifier) =>
identifier.SyntaxTree.GetLineSpan(identifier.Span).StartLinePosition;

public static int GetStartLine(SyntaxToken identifier) =>
GetStartLinePosition(identifier).Line + 1;

private static CodeItemAccessEnum MapAccess(SyntaxTokenList modifiers, SyntaxNode source)
{
Expand Down
2 changes: 2 additions & 0 deletions CodeNav.Shared/Mappers/MethodMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public static class MethodMapper
item.Id = IdMapper.MapId(item.FullName, parameterList);
item.Kind = kind;
item.Moniker = IconMapper.MapMoniker(item.Kind, item.Access);
item.StartLine = BaseMapper.GetStartLine(identifier);
item.StartLinePosition = BaseMapper.GetStartLinePosition(identifier);

if (TriviaSummaryMapper.HasSummary(node) && SettingsHelper.UseXMLComments)
{
Expand Down

0 comments on commit 67ae1ea

Please sign in to comment.