From 9fbd7cb37de3778af5d7fc5856356541a7b025e5 Mon Sep 17 00:00:00 2001 From: Socolin Date: Tue, 5 Dec 2023 23:09:14 -0500 Subject: [PATCH] Fix settings --- gradle.properties | 2 +- .../Options/MockAliasesModel.cs | 30 ++++++++++++------- .../Options/NSubstituteCompleteOptionPage.cs | 6 ++-- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index 818c83c..ae06fa3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ DotnetPluginId=ReSharperPlugin.NSubstituteComplete DotnetSolution=NSubstituteComplete.sln RiderPluginId=nsubstitutecomplete -PluginVersion=1.11.0 +PluginVersion=1.11.1 BuildConfiguration=Release PublishToken="_PLACE_HOLDER_" diff --git a/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/MockAliasesModel.cs b/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/MockAliasesModel.cs index 03d5933..e961756 100644 --- a/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/MockAliasesModel.cs +++ b/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/MockAliasesModel.cs @@ -1,24 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; using JetBrains.Annotations; using JetBrains.Application.Settings; using JetBrains.Application.UI.Options; using JetBrains.IDE.UI.Extensions; using JetBrains.Lifetimes; using JetBrains.ReSharper.UnitTestFramework.Settings; +using JetBrains.ReSharper.UnitTestFramework.UI.Options.ViewModel; using JetBrains.Threading; +using JetBrains.Util.Media; namespace ReSharperPlugin.NSubstituteComplete.Options { - public class MockAliasesModel : BeTreeGridExtensions.DictionaryModel.FromIndexed - { - public MockAliasesModel( - Lifetime lifetime, - [NotNull] GroupingEventHosts hosts, - [NotNull] OptionsSettingsSmartContext smartContext + public class MockAliasesModel( + Lifetime lifetime, + [NotNull] GroupingEventHosts hosts, + [NotNull] OptionsSettingsSmartContext smartContext + ) + : BeTreeGridExtensions.DictionaryModel.FromScalar( + lifetime, + hosts, + smartContext, + smartContext.Schema.GetScalarEntry(s => s.MockAliases), + SemicolonSeparatedPairSerializer.Deserialize, + SemicolonSeparatedPairSerializer.Serialize ) - : base(lifetime, hosts, smartContext, smartContext.Schema.GetIndexedEntry>(s => s.EnvironmentVariablesIndexed)) - { - } - - public override Entry GetNewEntry() => new(this.myLifetime, this.mySaveRequested.Incoming, string.Empty, string.Empty); + { + public override Entry GetNewEntry() => new(myLifetime, mySaveRequested.Incoming, string.Empty, string.Empty); } } diff --git a/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/NSubstituteCompleteOptionPage.cs b/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/NSubstituteCompleteOptionPage.cs index 8db7a10..16b470b 100644 --- a/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/NSubstituteCompleteOptionPage.cs +++ b/src/dotnet/ReSharperPlugin.NSubstituteComplete/Options/NSubstituteCompleteOptionPage.cs @@ -60,11 +60,11 @@ [CanBeNull] ISolution solution var model = new MockAliasesModel(lifetime, threading.GroupingEvents, smartContext); var beToolbar = model.SelectedEntry.GetBeSingleSelectionListWithToolbar(model.Entries, lifetime, - (entryLt, line, _) => new List - { + (entryLt, line, _) => + [ solution == null ? line.Name.GetBeTextBox(entryLt) : line.Name.GetBeTextBox(entryLt).WithTypeCompletion(solution, lifetime, CSharpLanguage.Instance), solution == null ? line.Value.GetBeTextBox(entryLt) : line.Value.GetBeTextBox(entryLt).WithTypeCompletion(solution, lifetime, CSharpLanguage.Instance), - }, + ], iconHost, new[] {"Type (interface),*", "Alias,*"}, dock: BeDock.RIGHT)