store each solutions open tabs
This commit is contained in:
@@ -7,6 +7,7 @@ using SharpIDE.Application.Features.Events;
|
|||||||
using SharpIDE.Application.Features.Run;
|
using SharpIDE.Application.Features.Run;
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
using SharpIDE.Godot.Features.IdeSettings;
|
||||||
|
|
||||||
namespace SharpIDE.Godot.Features.CodeEditor;
|
namespace SharpIDE.Godot.Features.CodeEditor;
|
||||||
|
|
||||||
@@ -30,7 +31,20 @@ public partial class CodeEditorPanel : MarginContainer
|
|||||||
tabBar.TabClosePressed += OnTabClosePressed;
|
tabBar.TabClosePressed += OnTabClosePressed;
|
||||||
GlobalEvents.Instance.DebuggerExecutionStopped.Subscribe(OnDebuggerExecutionStopped);
|
GlobalEvents.Instance.DebuggerExecutionStopped.Subscribe(OnDebuggerExecutionStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
var thisSolution = Singletons.AppState.RecentSlns.Single(s => s.FilePath == Solution.FilePath);
|
||||||
|
thisSolution.IdeSolutionState.OpenTabs = _tabContainer.GetChildren().OfType<SharpIdeCodeEdit>()
|
||||||
|
.Select(t => new OpenTab
|
||||||
|
{
|
||||||
|
FilePath = t.SharpIdeFile.Path,
|
||||||
|
CaretLine = t.GetCaretLine(),
|
||||||
|
CaretColumn = t.GetCaretColumn()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public override void _UnhandledKeyInput(InputEvent @event)
|
public override void _UnhandledKeyInput(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (@event.IsActionPressed(InputStringNames.StepOver))
|
if (@event.IsActionPressed(InputStringNames.StepOver))
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ public record RecentSln
|
|||||||
{
|
{
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
public required string FilePath { get; set; }
|
public required string FilePath { get; set; }
|
||||||
|
public IdeSolutionState IdeSolutionState { get; set; } = new IdeSolutionState();
|
||||||
}
|
}
|
||||||
13
src/SharpIDE.Godot/Features/IdeSettings/IdeSolutionState.cs
Normal file
13
src/SharpIDE.Godot/Features/IdeSettings/IdeSolutionState.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace SharpIDE.Godot.Features.IdeSettings;
|
||||||
|
|
||||||
|
public class IdeSolutionState
|
||||||
|
{
|
||||||
|
public List<OpenTab> OpenTabs { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpenTab
|
||||||
|
{
|
||||||
|
public required string FilePath { get; set; }
|
||||||
|
public required int CaretLine { get; set; }
|
||||||
|
public required int CaretColumn { get; set; }
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ public partial class IdeWindow : Control
|
|||||||
}
|
}
|
||||||
ideRoot.SetSlnFilePath(slnPath);
|
ideRoot.SetSlnFilePath(slnPath);
|
||||||
var recentSln = 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.RemoveAll(s => s.FilePath == recentSln.FilePath); // Move to end (most recent)
|
||||||
Singletons.AppState.RecentSlns.Add(recentSln);
|
Singletons.AppState.RecentSlns.Add(recentSln);
|
||||||
|
|
||||||
await this.InvokeAsync(() =>
|
await this.InvokeAsync(() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user