using Godot; using Microsoft.Build.Locator; using Microsoft.Extensions.Hosting; using SharpIDE.Application.Features.Analysis; using SharpIDE.Application.Features.Build; using SharpIDE.Application.Features.Events; using SharpIDE.Application.Features.FilePersistence; using SharpIDE.Application.Features.FileWatching; using SharpIDE.Application.Features.Run; using SharpIDE.Application.Features.SolutionDiscovery; using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence; using SharpIDE.Godot.Features.BottomPanel; using SharpIDE.Godot.Features.CodeEditor; using SharpIDE.Godot.Features.CustomControls; using SharpIDE.Godot.Features.Run; using SharpIDE.Godot.Features.Search; using SharpIDE.Godot.Features.Search.SearchAllFiles; using SharpIDE.Godot.Features.SolutionExplorer; namespace SharpIDE.Godot; public partial class IdeRoot : Control { public IdeWindow IdeWindow { get; set; } = null!; private Button _openSlnButton = null!; private Button _buildSlnButton = null!; private Button _rebuildSlnButton = null!; private Button _cleanSlnButton = null!; private Button _restoreSlnButton = null!; private SearchWindow _searchWindow = null!; private SearchAllFilesWindow _searchAllFilesWindow = null!; private CodeEditorPanel _codeEditorPanel = null!; private SolutionExplorerPanel _solutionExplorerPanel = null!; private InvertedVSplitContainer _invertedVSplitContainer = null!; private RunPanel _runPanel = null!; private Button _runMenuButton = null!; private Popup _runMenuPopup = null!; private BottomPanelManager _bottomPanelManager = null!; private readonly PackedScene _runMenuItemScene = ResourceLoader.Load("res://Features/Run/RunMenuItem.tscn"); private TaskCompletionSource _nodeReadyTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); public override void _EnterTree() { GodotGlobalEvents.Instance = new GodotGlobalEvents(); GlobalEvents.Instance = new GlobalEvents(); BuildService.Instance = new BuildService(); // TODO: Sort out this mess with singletons, especially access across Application services Singletons.RunService = new RunService(); Singletons.BuildService = BuildService.Instance; Singletons.FileWatcher?.Dispose(); Singletons.FileWatcher = new IdeFileWatcher(); Singletons.FileManager = new IdeFileManager(); Singletons.FileExternalChangeHandler = new IdeFileExternalChangeHandler(); } public override void _Ready() { _openSlnButton = GetNode