From bb151f4802a2f9de28ce663b842642d16a5aae38 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Thu, 2 Oct 2025 21:41:03 +1000 Subject: [PATCH] fix reordering --- src/SharpIDE.Godot/Features/IdeSettings/AppState.cs | 2 +- src/SharpIDE.Godot/Features/SlnPicker/SlnPicker.cs | 2 +- src/SharpIDE.Godot/IdeWindow.cs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SharpIDE.Godot/Features/IdeSettings/AppState.cs b/src/SharpIDE.Godot/Features/IdeSettings/AppState.cs index 243a7a3..83f70dc 100644 --- a/src/SharpIDE.Godot/Features/IdeSettings/AppState.cs +++ b/src/SharpIDE.Godot/Features/IdeSettings/AppState.cs @@ -4,7 +4,7 @@ public class AppState { public string? LastOpenSolutionFilePath { get; set; } public IdeSettings IdeSettings { get; set; } = new IdeSettings(); - public HashSet RecentSlns { get; set; } = []; + public List RecentSlns { get; set; } = []; } public class IdeSettings diff --git a/src/SharpIDE.Godot/Features/SlnPicker/SlnPicker.cs b/src/SharpIDE.Godot/Features/SlnPicker/SlnPicker.cs index 23e1ec8..fbd8600 100644 --- a/src/SharpIDE.Godot/Features/SlnPicker/SlnPicker.cs +++ b/src/SharpIDE.Godot/Features/SlnPicker/SlnPicker.cs @@ -41,7 +41,7 @@ public partial class SlnPicker : Control private void PopulatePreviousSolutions() { _previousSlnsVBoxContainer.QueueFreeChildren(); - foreach (var previousSln in Singletons.AppState.RecentSlns.Reverse()) + foreach (var previousSln in Singletons.AppState.RecentSlns.AsEnumerable().Reverse()) { var node = _previousSlnEntryScene.Instantiate(); node.RecentSln = previousSln; diff --git a/src/SharpIDE.Godot/IdeWindow.cs b/src/SharpIDE.Godot/IdeWindow.cs index 65784b5..b7360c9 100644 --- a/src/SharpIDE.Godot/IdeWindow.cs +++ b/src/SharpIDE.Godot/IdeWindow.cs @@ -79,7 +79,9 @@ public partial class IdeWindow : Control return; } ideRoot.SetSlnFilePath(slnPath); - Singletons.AppState.RecentSlns.Add(new RecentSln { FilePath = slnPath, Name = Path.GetFileName(slnPath) }); + var recentSln = new RecentSln { FilePath = slnPath, Name = Path.GetFileName(slnPath) }; + Singletons.AppState.RecentSlns.RemoveAll(s => s == recentSln); // Move to end (most recent) + Singletons.AppState.RecentSlns.Add(recentSln); await this.InvokeAsync(() => {