Skip to content

Commit

Permalink
fix: JS: Go to Definition is broken #125
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir Boulema committed Oct 6, 2021
1 parent 7421f95 commit e5c3797
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion CodeNav.Shared/CodeViewUserControlTop.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Controls;
using CodeNav.Helpers;
using CodeNav.Models;
Expand Down
4 changes: 2 additions & 2 deletions CodeNav.Shared/Helpers/DocumentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public static async Task ScrollToLine(LinePosition linePosition, string filePath
{
try
{
var documentView = await VS.Documents.GetActiveDocumentViewAsync();
var documentView = await VS.Documents.GetActiveDocumentViewAsync();

if (documentView?.FilePath != filePath)
{
documentView = await VS.Documents.OpenInPreviewTabAsync(filePath);
Expand Down
3 changes: 2 additions & 1 deletion CodeNav.Shared/Mappers/JavaScript/BaseMapperJS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static T MapBase<T>(Node member, string id, ICodeViewUserControl control)
element.Id = name;
element.Tooltip = name;
element.StartLine = GetLineNumber(member, member.NodeStart);
element.StartLinePosition = new LinePosition(GetLineNumber(member, member.NodeStart), 0);
element.StartLinePosition = new LinePosition(GetLineNumber(member, member.NodeStart) - 1, 0);
element.EndLine = GetLineNumber(member, member.End);
element.EndLinePosition = new LinePosition(GetLineNumber(member, member.End), 0);
element.Span = new TextSpan(member.NodeStart, member.End.GetValueOrDefault() - member.NodeStart);
Expand All @@ -33,6 +33,7 @@ public static T MapBase<T>(Node member, string id, ICodeViewUserControl control)
element.FontFamily = new FontFamily(SettingsHelper.Font.FontFamily.Name);
element.FontStyle = FontStyleMapper.Map(SettingsHelper.Font.Style);
element.Control = control;
element.FilePath = control.CodeDocumentViewModel.FilePath;

return element;
}
Expand Down

0 comments on commit e5c3797

Please sign in to comment.