Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 5d759cd

Browse files
committed
Fix #453: Solution FormatterSettings are not persisted properly
1 parent 53bba82 commit 5d759cd

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ public static CSharpFormattingOptionsPersistence GetProjectOptions(IProject proj
100100
string key = project.FileName;
101101
if (!projectOptions.ContainsKey(key)) {
102102
// Lazily create options container for project
103-
projectOptions[key] = new CSharpFormattingOptionsPersistence(
103+
var projectFormattingPersistence = new CSharpFormattingOptionsPersistence(
104104
csproject.GlobalPreferences,
105105
new CSharpFormattingOptionsContainer((SolutionOptions ?? GlobalOptions).OptionsContainer)
106106
{
107107
DefaultText = StringParser.Parse("${res:CSharpBinding.Formatting.ProjectOptionReference}")
108108
});
109+
projectFormattingPersistence.Load();
110+
projectOptions[key] = projectFormattingPersistence;
109111
}
110112

111113
return projectOptions[key];
@@ -123,6 +125,7 @@ static void SolutionOpened(object sender, SolutionEventArgs e)
123125
{
124126
DefaultText = StringParser.Parse("${res:CSharpBinding.Formatting.SolutionOptionReference}")
125127
});
128+
SolutionOptions.Load();
126129
}
127130

128131
static void SolutionClosed(object sender, SolutionEventArgs e)

src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingEditor.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private void FillPresetList(CSharpFormattingOptionsContainer container)
151151
presets["SharpDevelop"] = FormattingOptionsFactory.CreateSharpDevelop;
152152
presets["Mono"] = FormattingOptionsFactory.CreateMono;
153153
presets["K&R"] = FormattingOptionsFactory.CreateKRStyle;
154-
presets["Allman"] = FormattingOptionsFactory.CreateAllman;
154+
presets["VisualStudio"] = FormattingOptionsFactory.CreateAllman;
155155
presets["Whitesmiths"] = FormattingOptionsFactory.CreateWhitesmiths;
156156
presets["GNU"] = FormattingOptionsFactory.CreateGNU;
157157

@@ -163,7 +163,7 @@ private void FillPresetList(CSharpFormattingOptionsContainer container)
163163
presetItems.Add(new ComboBoxItem { Content = "SharpDevelop", Tag = "SharpDevelop" });
164164
presetItems.Add(new ComboBoxItem { Content = "Mono", Tag = "Mono" });
165165
presetItems.Add(new ComboBoxItem { Content = "K&R", Tag = "K&R" });
166-
presetItems.Add(new ComboBoxItem { Content = "Allman", Tag = "Allman" });
166+
presetItems.Add(new ComboBoxItem { Content = "Visual Studio", Tag = "VisualStudio" });
167167
presetItems.Add(new ComboBoxItem { Content = "Whitesmiths", Tag = "Whitesmiths" });
168168
presetItems.Add(new ComboBoxItem { Content = "GNU", Tag = "GNU" });
169169
presetItems.Add(new ComboBoxItem { Content = "Empty", Tag = "Empty" });

src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public CSharpFormattingOptionPanel(CSharpFormattingOptionsPersistence persistenc
7979
public override void LoadOptions()
8080
{
8181
base.LoadOptions();
82-
persistenceHelper.Load();
8382
formattingEditor.OptionsContainer = persistenceHelper.StartEditing();
8483
}
8584

src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpProjectFormattingOptions.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ protected override void Load(ICSharpCode.SharpDevelop.Project.MSBuildBasedProjec
5151
persistenceHelper = CSharpFormattingOptionsPersistence.GetProjectOptions(project);
5252
formattingEditor.OptionsContainer = persistenceHelper.OptionsContainer;
5353
formattingEditor.AllowPresets = true;
54-
persistenceHelper.Load();
5554
persistenceHelper.OptionsContainer.PropertyChanged += ContainerPropertyChanged;
5655
}
5756

0 commit comments

Comments
 (0)