Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir L. Boulema committed Sep 11, 2021
1 parent 76ee60d commit 5d72c34
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
17 changes: 0 additions & 17 deletions CodeNav.Shared/Helpers/DocumentHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Outlining;
using System;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -63,21 +62,6 @@ public static async Task<int> GetNumberOfLines()
return 0;
}

public static async Task<int?> GetCurrentLineNumber()
{
try
{
var documentView = await VS.Documents.GetActiveDocumentViewAsync();
return documentView?.TextView?.Selection.ActivePoint.Position.GetContainingLine().LineNumber;
}
catch (Exception)
{
// Ignore
}

return null;
}

public static async Task ScrollToLine(LinePosition linePosition)
{
try
Expand Down Expand Up @@ -221,7 +205,6 @@ public static async Task UpdateDocument(ICodeViewUserControl control,
try
{
// Sync all regions
var documentView = await VS.Documents.GetActiveDocumentViewAsync();
OutliningHelper.SyncAllRegions(codeDocumentViewModel.CodeDocument).FireAndForget();

// Should the margin be shown and are there any items to show, if not hide the margin
Expand Down
2 changes: 1 addition & 1 deletion CodeNav.Shared/Helpers/HistoryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void AddItemToHistory(CodeDocumentViewModel model, Span span)

public static void AddItemToHistory(CodeItem item)
{
if (item == null)
if (item?.Control?.CodeDocumentViewModel == null)
{
return;
}
Expand Down
4 changes: 3 additions & 1 deletion CodeNav.Shared/Helpers/PlaceholderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ private static List<CodeItem> CreateItem(string name, ImageMoniker moniker)
new CodeNamespaceItem
{
Id = name,
IsExpanded = true,
Members = new List<CodeItem>
{
new CodeClassItem
Expand All @@ -33,7 +34,8 @@ private static List<CodeItem> CreateItem(string name, ImageMoniker moniker)
Id = name,
ForegroundColor = Colors.Black,
BorderColor = Colors.DarkGray,
Moniker = moniker
Moniker = moniker,
IsExpanded = true
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions CodeNav.Shared/ToolWindow/CodeNavToolWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public override async Task<FrameworkElement> CreateAsync(int toolWindowId, Cance

_control = new CodeViewUserControl();

_control.tag = "toolwindow";
//_control.CodeDocumentViewModel.CodeDocument = PlaceholderHelper.CreateSelectDocumentItem();
_control.CodeDocumentViewModel.CodeDocument = PlaceholderHelper.CreateSelectDocumentItem();

return _control;
}
Expand Down

0 comments on commit 5d72c34

Please sign in to comment.