diff --git a/CodeNav.Shared/Mappers/RegionMapper.cs b/CodeNav.Shared/Mappers/RegionMapper.cs index 94b83ab..0f9c02e 100644 --- a/CodeNav.Shared/Mappers/RegionMapper.cs +++ b/CodeNav.Shared/Mappers/RegionMapper.cs @@ -26,7 +26,8 @@ public static List MapRegions(SyntaxTree tree, TextSpan span, IC { var regionList = new List(); - if (tree == null) + if (tree == null || + !General.Instance.ShowRegions) { return regionList; } @@ -178,8 +179,12 @@ private static string MapRegionName(SyntaxTrivia source) /// public static bool AddToRegion(List regions, CodeItem item) { - if (item?.StartLine == null) return false; - + if (item?.StartLine == null || + !General.Instance.ShowRegions) + { + return false; + } + foreach (var region in regions) { if (region?.Kind == CodeItemKindEnum.Region) diff --git a/CodeNav.Shared/Options/General.cs b/CodeNav.Shared/Options/General.cs index 8b53356..5872a66 100644 --- a/CodeNav.Shared/Options/General.cs +++ b/CodeNav.Shared/Options/General.cs @@ -42,4 +42,6 @@ public class General : BaseOptionModel public int SortOrder { get; set; } = 0; public bool UpdateWhileTyping { get; set; } = false; + + public bool ShowRegions { get; set; } = true; } \ No newline at end of file diff --git a/CodeNav.Shared/ViewModels/OptionsWindowViewModel.cs b/CodeNav.Shared/ViewModels/OptionsWindowViewModel.cs index ff55921..e29ee44 100644 --- a/CodeNav.Shared/ViewModels/OptionsWindowViewModel.cs +++ b/CodeNav.Shared/ViewModels/OptionsWindowViewModel.cs @@ -35,6 +35,14 @@ public bool ShowHistoryIndicators set => SetProperty(ref _showHistoryIndicators, value); } + private bool _showRegions = true; + + public bool ShowRegions + { + get => _showRegions; + set => SetProperty(ref _showRegions, value); + } + private bool _disableHighlight = false; public bool DisableHighlight diff --git a/CodeNav.Shared/Windows/OptionsWindow.xaml b/CodeNav.Shared/Windows/OptionsWindow.xaml index ee4d582..081308f 100644 --- a/CodeNav.Shared/Windows/OptionsWindow.xaml +++ b/CodeNav.Shared/Windows/OptionsWindow.xaml @@ -102,6 +102,10 @@ Show the filter toolbar + + Show regions + + Use XML comments for method tooltips diff --git a/CodeNav.Shared/Windows/OptionsWindow.xaml.cs b/CodeNav.Shared/Windows/OptionsWindow.xaml.cs index 67f97e1..249a717 100644 --- a/CodeNav.Shared/Windows/OptionsWindow.xaml.cs +++ b/CodeNav.Shared/Windows/OptionsWindow.xaml.cs @@ -31,7 +31,8 @@ private void OptionsWindow_Loaded(object sender, RoutedEventArgs e) UpdateWhileTyping = General.Instance.UpdateWhileTyping, Font = SettingsHelper.Font, BackgroundColor = General.Instance.BackgroundColor, - HighlightColor = General.Instance.HighlightColor + HighlightColor = General.Instance.HighlightColor, + ShowRegions = General.Instance.ShowRegions, }; } @@ -103,6 +104,7 @@ private void OkClick(object sender, RoutedEventArgs e) General.Instance.AutoLoadLineThreshold = ViewModel.AutoLoadLineThreshold; General.Instance.BackgroundColor = ViewModel.BackgroundColor; General.Instance.HighlightColor = ViewModel.HighlightColor; + General.Instance.ShowRegions = ViewModel.ShowRegions; General.Instance.Save(); @@ -134,6 +136,7 @@ private void ResetClick(object sender, RoutedEventArgs e) General.Instance.UpdateWhileTyping = false; General.Instance.AutoLoadLineThreshold = 0; General.Instance.BackgroundColor = ColorHelper.Transparent(); + General.Instance.ShowRegions = true; General.Instance.Save(); SettingsHelper.Refresh();