From be31d92dcd8bcf1a7fe6f0a9d72d3e5f591d47f3 Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sat, 27 Apr 2024 21:04:57 -0400 Subject: [PATCH 01/56] create PR --- .../Shareds/Displays/Internals/IdeInfoDisplay.razor | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor index 69d8231cb..c9a155039 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor @@ -18,6 +18,15 @@
Recent Changes:
+
+
v (WIP_VERSION) (WIP_DATE)
+ +
    +
  • + (WIP_DESCRIPTION) +
  • +
+
v 0.8.2.0 (2024-04-27)
From dac68ed975341a84f45bed9b3b1a3721ab6165cd Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 13:20:56 -0400 Subject: [PATCH 02/56] Add personal paths for Linux --- .../Shareds/Displays/IdeMainLayout.razor.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs index a1d09d032..23bd5d2f3 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs @@ -11,6 +11,7 @@ using Luthetus.Ide.RazorLib.ProgramExecutions.States; using Luthetus.TextEditor.RazorLib; using Microsoft.AspNetCore.Components; +using System.Runtime.InteropServices; namespace Luthetus.Ide.RazorLib.Shareds.Displays; @@ -84,9 +85,15 @@ protected override async Task OnAfterRenderAsync(bool firstRender) string personalTestPath; #if DEBUG - personalTestPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.sln"; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + personalTestPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.sln"; + else + personalTestPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.sln"; #else - personalTestPath = "C:\\Users\\hunte\\Repos\\Luthetus.Ide_Fork\\Luthetus.Ide.sln"; + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + personalTestPath = "/home/hunter/Repos/Luthetus.Ide_Fork/Luthetus.Ide.sln"; + else + personalTestPath = "C:\\Users\\hunte\\Repos\\Luthetus.Ide_Fork\\Luthetus.Ide.sln"; #endif if (await FileSystemProvider.File.ExistsAsync(personalTestPath)) @@ -98,9 +105,16 @@ protected override async Task OnAfterRenderAsync(bool firstRender) DotNetSolutionSync.SetDotNetSolution(absolutePath); #if DEBUG + string personalProjectPath; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + personalProjectPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.ServerSide/BlazorCrudApp.ServerSide.csproj"; + else + personalProjectPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.csproj"; + Dispatcher.Dispatch(new ProgramExecutionState.SetStartupProjectAbsolutePathAction( EnvironmentProvider.AbsolutePathFactory( - "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.csproj", + personalProjectPath, false))); #endif } From 9eb697c53ea7bdad6b16415cb52643f45ed3f7fb Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 14:39:06 -0400 Subject: [PATCH 03/56] Working on linux --- .vscode/settings.json | 3 +++ Source/Lib/Ide/Host.Photino/Program.cs | 7 ++++--- .../States/DotNetSolutionSync.Tasks.cs | 11 +++++++++++ .../Basis/Clipboards/Models/ClipboardFactsTests.cs | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..b18344d4b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet-test-explorer.testProjectPath": "/home/hunter/Repos/Luthetus.Ide_Fork/Source/Tests/Ide/Luthetus.Ide.Tests.csproj" +} \ No newline at end of file diff --git a/Source/Lib/Ide/Host.Photino/Program.cs b/Source/Lib/Ide/Host.Photino/Program.cs index 11df45550..383220b72 100644 --- a/Source/Lib/Ide/Host.Photino/Program.cs +++ b/Source/Lib/Ide/Host.Photino/Program.cs @@ -46,10 +46,11 @@ static void Main(string[] args) .SetLeft(50) .SetTop(50); - if (Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) == "C:\\Users\\hunte") - { + var specialFolderUserProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + if (specialFolderUserProfile == "C:\\Users\\hunte") app.MainWindow.SetLeft(1_355); - } + else if (specialFolderUserProfile == "/home/hunter") + app.MainWindow.SetLeft(1_100).SetTop(100).SetHeight(1900); var continuousStartCts = new CancellationTokenSource(); var blockingStartCts = new CancellationTokenSource(); diff --git a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs index 06d048375..475896b25 100644 --- a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs @@ -15,6 +15,7 @@ using static Luthetus.Ide.RazorLib.DotNetSolutions.States.DotNetSolutionState; using Luthetus.Ide.RazorLib.CommandLines.Models; using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.Common.RazorLib.Notifications.Models; namespace Luthetus.Ide.RazorLib.DotNetSolutions.States; @@ -96,6 +97,16 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) dotNetSolutionAbsolutePathString, false); + // Debugging Linux-Ubuntu (2024-04-28) + { + NotificationHelper.DispatchDebugMessage( + solutionAbsolutePath.Value, + () => solutionAbsolutePath.Value, + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(10)); + } + var solutionNamespacePath = new NamespacePath( string.Empty, solutionAbsolutePath); diff --git a/Source/Tests/Ide/Basis/Clipboards/Models/ClipboardFactsTests.cs b/Source/Tests/Ide/Basis/Clipboards/Models/ClipboardFactsTests.cs index fdf79fdcb..61f9f4d60 100644 --- a/Source/Tests/Ide/Basis/Clipboards/Models/ClipboardFactsTests.cs +++ b/Source/Tests/Ide/Basis/Clipboards/Models/ClipboardFactsTests.cs @@ -14,6 +14,7 @@ public class ClipboardFactsTests [Fact] public void Tag() { + var aaa = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); Assert.Equal("`'\";luth_clipboard", ClipboardFacts.Tag); } From ac5324a6787d042187577daf72ac3c43087d4988 Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 14:57:11 -0400 Subject: [PATCH 04/56] Debugging Linux-Ubuntu (2024-04-28) --- .../States/DotNetSolutionSync.Tasks.cs | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs index 475896b25..95396f678 100644 --- a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs @@ -97,16 +97,6 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) dotNetSolutionAbsolutePathString, false); - // Debugging Linux-Ubuntu (2024-04-28) - { - NotificationHelper.DispatchDebugMessage( - solutionAbsolutePath.Value, - () => solutionAbsolutePath.Value, - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(10)); - } - var solutionNamespacePath = new NamespacePath( string.Empty, solutionAbsolutePath); @@ -123,18 +113,76 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) foreach (var project in parser.DotNetProjectList) { + // Debugging Linux-Ubuntu (2024-04-28) + { + NotificationHelper.DispatchDebugMessage( + "project.DisplayName", + () => project.DisplayName, + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(60)); + } + + // Debugging Linux-Ubuntu (2024-04-28) + // ----------------------------------- + // It is believed, that Linux-Ubuntu is not fully working correctly, + // due to the directory separator character at the os level being '/', + // meanwhile the .NET solution has as its directory separator character '\'. + // + // Will perform a string.Replace("\\", "/") here. And if it solves the issue, + // then some standard way of doing this needs to be made available in the IEnvironmentProvider. + // + // Okay, this single replacement fixes 99% of the solution explorer issue. + // And I say 99% instead of 100% just because I haven't tested every single part of it yet. var relativePathFromSolutionFileString = project.RelativePathFromSolutionFileString; + relativePathFromSolutionFileString = relativePathFromSolutionFileString.Replace("\\", "/"); + + // Debugging Linux-Ubuntu (2024-04-28) + { + NotificationHelper.DispatchDebugMessage( + "relativePathFromSolutionFileString", + () => relativePathFromSolutionFileString, + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(60)); + } // Solution Folders do not exist on the filesystem. Therefore their absolute path is not guaranteed to be unique // One can use the ProjectIdGuid however, when working with a SolutionFolder to make the absolute path unique. if (project.DotNetProjectKind == DotNetProjectKind.SolutionFolder) relativePathFromSolutionFileString = $"{project.ProjectIdGuid}_{relativePathFromSolutionFileString}"; + // Debugging Linux-Ubuntu (2024-04-28) + { + NotificationHelper.DispatchDebugMessage( + "DirectorySeparatorChar", + () => _environmentProvider.DirectorySeparatorChar.ToString(), + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(60)); + NotificationHelper.DispatchDebugMessage( + "AltDirectorySeparatorChar", + () => _environmentProvider.AltDirectorySeparatorChar.ToString(), + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(60)); + } + var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( solutionAbsolutePath, relativePathFromSolutionFileString, _environmentProvider); + // Debugging Linux-Ubuntu (2024-04-28) + { + NotificationHelper.DispatchDebugMessage( + "absolutePathString", + () => absolutePathString, + _commonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(60)); + } + project.AbsolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, false); } From 96db306b43e2790a58ff370d25a336682fa97f4f Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 14:59:24 -0400 Subject: [PATCH 05/56] Delete dead code --- .../States/DotNetSolutionSync.Tasks.cs | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs index 95396f678..93ba21657 100644 --- a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs @@ -113,16 +113,6 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) foreach (var project in parser.DotNetProjectList) { - // Debugging Linux-Ubuntu (2024-04-28) - { - NotificationHelper.DispatchDebugMessage( - "project.DisplayName", - () => project.DisplayName, - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(60)); - } - // Debugging Linux-Ubuntu (2024-04-28) // ----------------------------------- // It is believed, that Linux-Ubuntu is not fully working correctly, @@ -136,53 +126,17 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) // And I say 99% instead of 100% just because I haven't tested every single part of it yet. var relativePathFromSolutionFileString = project.RelativePathFromSolutionFileString; relativePathFromSolutionFileString = relativePathFromSolutionFileString.Replace("\\", "/"); - - // Debugging Linux-Ubuntu (2024-04-28) - { - NotificationHelper.DispatchDebugMessage( - "relativePathFromSolutionFileString", - () => relativePathFromSolutionFileString, - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(60)); - } // Solution Folders do not exist on the filesystem. Therefore their absolute path is not guaranteed to be unique // One can use the ProjectIdGuid however, when working with a SolutionFolder to make the absolute path unique. if (project.DotNetProjectKind == DotNetProjectKind.SolutionFolder) relativePathFromSolutionFileString = $"{project.ProjectIdGuid}_{relativePathFromSolutionFileString}"; - // Debugging Linux-Ubuntu (2024-04-28) - { - NotificationHelper.DispatchDebugMessage( - "DirectorySeparatorChar", - () => _environmentProvider.DirectorySeparatorChar.ToString(), - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(60)); - NotificationHelper.DispatchDebugMessage( - "AltDirectorySeparatorChar", - () => _environmentProvider.AltDirectorySeparatorChar.ToString(), - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(60)); - } - var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( solutionAbsolutePath, relativePathFromSolutionFileString, _environmentProvider); - // Debugging Linux-Ubuntu (2024-04-28) - { - NotificationHelper.DispatchDebugMessage( - "absolutePathString", - () => absolutePathString, - _commonComponentRenderers, - Dispatcher, - TimeSpan.FromSeconds(60)); - } - project.AbsolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, false); } From 06e4e7c4427da8f8ec86b95332fefdab39545562 Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 15:31:25 -0400 Subject: [PATCH 06/56] Paste from clipboard on Linux-Ubuntu --- Source/Lib/Common/wwwroot/luthetusCommon.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/Lib/Common/wwwroot/luthetusCommon.js b/Source/Lib/Common/wwwroot/luthetusCommon.js index 99e834264..e2609b9d9 100644 --- a/Source/Lib/Common/wwwroot/luthetusCommon.js +++ b/Source/Lib/Common/wwwroot/luthetusCommon.js @@ -78,7 +78,25 @@ } }); } catch (e) { - return ""; + // Debugging Linux-Ubuntu (2024-04-28) + // ----------------------------------- + // Reading clipboard is not working. + // + // Fixed with the following inner-try/catch block. + // + // This fix upsets me. Seemingly the permission + // "clipboard-read" doesn't exist for some user-agents + // But so long as you don't check for permission it lets you read + // the clipboard? + try { + return navigator.clipboard + .readText() + .then((clipText) => { + return clipText; + }); + } catch (innerException) { + return ""; + } } }, setClipboard: function (value) { From c221624544e742573fb5a6a54f390c884bd108cd Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 15:35:26 -0400 Subject: [PATCH 07/56] TODO: Unhandled exception --- .../TextEditors/Displays/Internals/TextSelectionGroup.razor | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Lib/TextEditor/TextEditors/Displays/Internals/TextSelectionGroup.razor b/Source/Lib/TextEditor/TextEditors/Displays/Internals/TextSelectionGroup.razor index b7dda68c0..88daadb6c 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/Internals/TextSelectionGroup.razor +++ b/Source/Lib/TextEditor/TextEditors/Displays/Internals/TextSelectionGroup.razor @@ -9,6 +9,7 @@ var selectionBoundsInRowIndexUnits = GetSelectionBoundsInRowIndexUnits(selectionBoundsInPositionIndexUnits); + @* TODO: Unhandled exception. System.InvalidOperationException: Sequence contains no elements (2024-04-28) *@ var virtualLowerBoundInclusiveRowIndex = RenderBatch.ViewModel!.VirtualizationResult.EntryList.First().Index; var virtualUpperBoundExclusiveRowIndex = 1 + RenderBatch.ViewModel.VirtualizationResult.EntryList.Last().Index; From 84832d795f330f1308e724ebd16c8127d58a5b3c Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 16:07:55 -0400 Subject: [PATCH 08/56] Fix: local storage --- .../JsRuntimes/Models/LuthetusCommonJavaScriptInteropApi.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Lib/Common/JsRuntimes/Models/LuthetusCommonJavaScriptInteropApi.cs b/Source/Lib/Common/JsRuntimes/Models/LuthetusCommonJavaScriptInteropApi.cs index d21f95e9d..c9c65ba2d 100644 --- a/Source/Lib/Common/JsRuntimes/Models/LuthetusCommonJavaScriptInteropApi.cs +++ b/Source/Lib/Common/JsRuntimes/Models/LuthetusCommonJavaScriptInteropApi.cs @@ -41,9 +41,9 @@ public ValueTask LocalStorageSetItem(string key, object? value) value); } - public ValueTask LocalStorageGetItem(string key) + public ValueTask LocalStorageGetItem(string key) { - return _jsRuntime.InvokeAsync( + return _jsRuntime.InvokeAsync( "luthetusCommon.localStorageGetItem", key); } From d4a8d2f7383654eb25242cd6355867df8284aade Mon Sep 17 00:00:00 2001 From: Hunter Freeman Date: Sun, 28 Apr 2024 16:52:56 -0400 Subject: [PATCH 09/56] Add check if not windows --- .../States/DotNetSolutionSync.Tasks.cs | 9 ++++--- .../Ide.RazorLib/Terminals/Models/README.md | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Terminals/Models/README.md diff --git a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs index 93ba21657..0c1d356c2 100644 --- a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs @@ -1,4 +1,5 @@ using System.Collections.Immutable; +using System.Runtime.InteropServices; using Luthetus.Common.RazorLib.TreeViews.Models; using Luthetus.Common.RazorLib.Namespaces.Models; using Luthetus.Common.RazorLib.FileSystems.Models; @@ -113,7 +114,9 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) foreach (var project in parser.DotNetProjectList) { - // Debugging Linux-Ubuntu (2024-04-28) + var relativePathFromSolutionFileString = project.RelativePathFromSolutionFileString; + + // Debugging Linux-Ubuntu (2024-04-28) // ----------------------------------- // It is believed, that Linux-Ubuntu is not fully working correctly, // due to the directory separator character at the os level being '/', @@ -124,8 +127,8 @@ private async Task SetDotNetSolutionAsync(IAbsolutePath inSolutionAbsolutePath) // // Okay, this single replacement fixes 99% of the solution explorer issue. // And I say 99% instead of 100% just because I haven't tested every single part of it yet. - var relativePathFromSolutionFileString = project.RelativePathFromSolutionFileString; - relativePathFromSolutionFileString = relativePathFromSolutionFileString.Replace("\\", "/"); + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + relativePathFromSolutionFileString = relativePathFromSolutionFileString.Replace("\\", "/"); // Solution Folders do not exist on the filesystem. Therefore their absolute path is not guaranteed to be unique // One can use the ProjectIdGuid however, when working with a SolutionFolder to make the absolute path unique. diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/README.md b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/README.md new file mode 100644 index 000000000..4bf8d33f6 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/README.md @@ -0,0 +1,24 @@ +Goal: readonly text editor model +(2024-04-28) +-------------------------------- + +Question: +- Is readonly attached to a model +- Or is readonly attached to a viewmodel? + +Goal: test explorer +(2024-04-28) +-------------------------------- + +- Test explorer needs to filter the terminal to just + the output of a single command. + +Solution: +- Add readonly viewmodel +- readonly keymap +- ??? + +Terminal.cs: +- Needs to track the position index when a command begins and ends +- Then a dictionary maps terminal command to position start and end indices +- Pull this text out into its own model? \ No newline at end of file From 3a74a3a7b1cec35f5801f7b2e9ec649b61d857ba Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:28:55 -0400 Subject: [PATCH 10/56] ran a test saw output. extremely tired so abruptly committing this before I go to bed --- .../CSharpProjectFormDisplay.razor.cs | 13 +- .../Ide.RazorLib/Gits/States/GitSync.Tasks.cs | 6 +- .../Displays/TerminalGroupDisplay.razor | 6 - .../Ide.RazorLib/Terminals/Models/Terminal.cs | 501 +++++++++--------- .../Terminals/Models/TerminalCommand.cs | 2 +- .../Models/TerminalCommandBoundary.cs | 7 + .../Displays/TestExplorerContextMenu.razor.cs | 8 +- .../Displays/TestExplorerDetailsDisplay.razor | 37 +- .../TestExplorerDetailsDisplay.razor.cs | 7 + .../States/TestExplorerSync.Tasks.cs | 15 +- .../TreeViewStringFragmentDisplay.razor | 7 +- .../ReadOnlys/TextEditorKeymapReadOnly.cs | 257 +++++++++ .../TextEditorKeymapReadOnlyFacts.cs | 17 + .../Lexes/Models/TextEditorTextSpan.cs | 18 +- .../ReadOnlyTextEditorViewModelDisplay.razor | 6 + ...eadOnlyTextEditorViewModelDisplay.razor.cs | 43 ++ .../Models/TextEditorModel.Constructors.cs | 3 + .../Models/TextEditorModelExtensionMethods.cs | 3 + .../Models/TextEditorModelModifier.cs | 8 +- .../Basis/Terminals/Models/TerminalTests.cs | 36 -- 20 files changed, 669 insertions(+), 331 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommandBoundary.cs create mode 100644 Source/Lib/TextEditor/Keymaps/Models/ReadOnlys/TextEditorKeymapReadOnly.cs create mode 100644 Source/Lib/TextEditor/Keymaps/Models/ReadOnlys/TextEditorKeymapReadOnlyFacts.cs create mode 100644 Source/Lib/TextEditor/TextEditors/Displays/Internals/ReadOnlyTextEditorViewModelDisplay.razor create mode 100644 Source/Lib/TextEditor/TextEditors/Displays/Internals/ReadOnlyTextEditorViewModelDisplay.razor.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs index 70aff3155..df6a7cca3 100644 --- a/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs @@ -20,6 +20,7 @@ using Luthetus.Ide.RazorLib.Websites; using Luthetus.Common.RazorLib.Dynamics.Models; using Luthetus.TextEditor.RazorLib; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; namespace Luthetus.Ide.RazorLib.CSharpProjectForms.Displays; @@ -133,8 +134,11 @@ private async Task EnqueueDotNetNewListAsync() _viewModel.NewCSharpProjectCancellationTokenSource.Token, async () => { - var output = generalTerminal.ReadStandardOut(_viewModel.LoadProjectTemplatesTerminalCommandKey); - + var success = generalTerminal.TryGetTerminalCommandTextSpan( + _viewModel.LoadProjectTemplatesTerminalCommandKey, + out var terminalCommandTextSpan); + + var output = terminalCommandTextSpan?.GetText(); if (output is not null) { _viewModel.ProjectTemplateList = DotNetCliOutputParser.ParseDotNetNewListTerminalOutput(output); @@ -175,8 +179,11 @@ private async Task EnqueueDotnetNewListDeprecatedAsync() _viewModel.NewCSharpProjectCancellationTokenSource.Token, async () => { - var output = generalTerminal.ReadStandardOut(_viewModel.LoadProjectTemplatesTerminalCommandKey); + var success = generalTerminal.TryGetTerminalCommandTextSpan( + _viewModel.LoadProjectTemplatesTerminalCommandKey, + out var terminalCommandTextSpan); + var output = terminalCommandTextSpan?.GetText(); if (output is not null) { _viewModel.ProjectTemplateList = DotNetCliOutputParser.ParseDotNetNewListTerminalOutput(output); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs index e09c78004..dcc3e1766 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs @@ -58,9 +58,11 @@ private async Task RefreshGitAsync(CancellationToken cancellationToken) CancellationToken.None, async () => { - var gitStatusOutput = generalTerminal.ReadStandardOut( - GitFacts.GitStatusTerminalCommandKey); + var success = generalTerminal.TryGetTerminalCommandTextSpan( + GitFacts.GitStatusTerminalCommandKey, + out var terminalCommandTextSpan); + var gitStatusOutput = terminalCommandTextSpan.GetText(); if (gitStatusOutput is null) return; diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Displays/TerminalGroupDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Terminals/Displays/TerminalGroupDisplay.razor index 76424b048..f5f05297c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Displays/TerminalGroupDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Displays/TerminalGroupDisplay.razor @@ -62,12 +62,6 @@ @terminal.DisplayName - - @{ var isKillProcessDisabled = !terminal.HasExecutingProcess; } +
+
+
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs new file mode 100644 index 000000000..37474e007 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -0,0 +1,42 @@ +using Luthetus.Ide.RazorLib.InputFiles.Models; +using Luthetus.Ide.RazorLib.InputFiles.States; +using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitPickGitFolderDisplay : ComponentBase +{ + [Inject] + private InputFileSync InputFileSync { get; set; } = null!; + + private string _gitFolderAbsolutePath = string.Empty; + + private void RequestInputFileForGitFolder() + { + InputFileSync.RequestInputFileStateForm("Git Folder", + async absolutePath => + { + if (absolutePath is null) + return; + + _gitFolderAbsolutePath = absolutePath.Value; + await InvokeAsync(StateHasChanged); + }, + absolutePath => + { + if (absolutePath is null || + !absolutePath.IsDirectory || + absolutePath.NameNoExtension != ".git") + { + return Task.FromResult(false); + } + + return Task.FromResult(true); + }, + new[] + { + new InputFilePattern("Directory", absolutePath => absolutePath.IsDirectory) + }.ToImmutableArray()); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Installations/Displays/LuthetusIdeInitializer.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Installations/Displays/LuthetusIdeInitializer.razor.cs index 0bdcb5f05..2263428f4 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Installations/Displays/LuthetusIdeInitializer.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Installations/Displays/LuthetusIdeInitializer.razor.cs @@ -24,6 +24,7 @@ using Luthetus.Common.RazorLib.Dialogs.Models; using Microsoft.JSInterop; using Luthetus.TextEditor.RazorLib; +using Luthetus.Ide.RazorLib.Gits.Displays; namespace Luthetus.Ide.RazorLib.Installations.Displays; @@ -132,6 +133,20 @@ private void InitializeLeftPanelTabs() Dispatcher.Dispatch(new PanelState.RegisterPanelAction(solutionExplorerPanel)); Dispatcher.Dispatch(new PanelState.RegisterPanelTabAction(leftPanel.Key, solutionExplorerPanel, false)); + // gitPanel + var gitPanel = new Panel( + "Git Changes", + Key.NewKey(), + Key.NewKey(), + ContextFacts.GitContext.ContextKey, + typeof(GitDisplay), + null, + Dispatcher, + DialogService, + JsRuntime); + Dispatcher.Dispatch(new PanelState.RegisterPanelAction(gitPanel)); + Dispatcher.Dispatch(new PanelState.RegisterPanelTabAction(leftPanel.Key, gitPanel, false)); + // folderExplorerPanel var folderExplorerPanel = new Panel( "Folder Explorer", From 59134162d05d33db6d092c1d8cc855294b69dee2 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 15:12:38 -0400 Subject: [PATCH 29/56] Add: TerminalCommand.ParseFunc --- .../Gits/Displays/GitControlsDisplay.razor | 6 +++ .../Gits/Displays/GitControlsDisplay.razor.cs | 43 +++++++++++++++++++ .../Gits/Displays/GitDisplay.razor | 28 +++++++----- .../Gits/Displays/GitDisplay.razor.cs | 3 +- .../Displays/GitPickGitFolderDisplay.razor | 5 +++ .../Displays/GitPickGitFolderDisplay.razor.cs | 18 ++++++++ .../Displays/StartupControlsDisplay.razor.cs | 3 +- .../Ide.RazorLib/Terminals/Models/Terminal.cs | 15 ++++--- .../Terminals/Models/TerminalCommand.cs | 4 +- 9 files changed, 105 insertions(+), 20 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor new file mode 100644 index 000000000..6395fa931 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -0,0 +1,6 @@ +
+ +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs new file mode 100644 index 000000000..e073a1380 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -0,0 +1,43 @@ +using Fluxor; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Ide.RazorLib.CommandLines.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.Ide.RazorLib.Terminals.States; +using Microsoft.AspNetCore.Components; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitControlsDisplay : ComponentBase +{ + [Inject] + private IState TerminalStateWrap { get; set; } = null!; + + [CascadingParameter] + public GitState GitState { get; set; } = null!; + + public Key NewDotNetSolutionTerminalCommandKey { get; } = Key.NewKey(); + + private async Task ExecuteGitStatusTerminalCommandOnClick() + { + var localGitState = GitState; + + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { GitCliFacts.STATUS_COMMAND }); + + var gitStatusCommand = new TerminalCommand( + NewDotNetSolutionTerminalCommandKey, + formattedCommand, + parentDirectory.Value, + CancellationToken.None); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitStatusCommand); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor index a3746049d..de5df996f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor @@ -1,4 +1,6 @@ -@using Luthetus.Common.RazorLib.Contexts.Displays +@inherits Fluxor.Blazor.Web.Components.FluxorComponent + +@using Luthetus.Common.RazorLib.Contexts.Displays @using Luthetus.Common.RazorLib.Contexts.Models
- @if (gitState.GitFolderAbsolutePath is null) - { - - } - else - { -
- You have chosen: @gitState.GitFolderAbsolutePath -
- } + + @if (gitState.GitFolderAbsolutePath is null) + { + + } + else + { +
+ You have chosen: @gitState.GitFolderAbsolutePath +
+ + + } +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor.cs index 78cb2af90..e2a7c6217 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor.cs @@ -1,4 +1,5 @@ using Fluxor; +using Fluxor.Blazor.Web.Components; using Luthetus.Ide.RazorLib.Gits.States; using Microsoft.AspNetCore.Components; @@ -8,7 +9,7 @@ namespace Luthetus.Ide.RazorLib.Gits.Displays; /// Long term goal is to support any arbitrary version control system. /// For now, implement a Git UI, this lets us get a feel for what the interface should be. /// -public partial class GitDisplay : ComponentBase +public partial class GitDisplay : FluxorComponent { [Inject] private IState GitStateWrap { get; set; } = null!; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor index df2f0c1a6..ef4310130 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor @@ -18,5 +18,10 @@ + + \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 37474e007..2213aab5f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -1,3 +1,7 @@ +using Fluxor; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Ide.RazorLib.Gits.Models; +using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.InputFiles.Models; using Luthetus.Ide.RazorLib.InputFiles.States; using Microsoft.AspNetCore.Components; @@ -9,6 +13,10 @@ public partial class GitPickGitFolderDisplay : ComponentBase { [Inject] private InputFileSync InputFileSync { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; private string _gitFolderAbsolutePath = string.Empty; @@ -39,4 +47,14 @@ private void RequestInputFileForGitFolder() new InputFilePattern("Directory", absolutePath => absolutePath.IsDirectory) }.ToImmutableArray()); } + + private void ConfirmGitFolderOnClick() + { + Dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => inState with + { + GitFolderAbsolutePath = EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true), + ActiveGitTasks = ImmutableList.Empty, + GitFilesList = ImmutableList.Empty, + })); + } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs index 709541304..6496598ec 100644 --- a/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs @@ -40,7 +40,8 @@ public partial class StartupControlsDisplay : FluxorComponent _newDotNetSolutionTerminalCommandKey, formattedCommand, ancestorDirectory.Value, - _newDotNetSolutionCancellationTokenSource.Token); + _newDotNetSolutionCancellationTokenSource.Token, + ParseFunc: DotNetRunOutputParser.Parse); } private async Task StartProgramWithoutDebuggingOnClick() diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index b5cd0e5cf..d95ed937a 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -188,7 +188,7 @@ await command.Observe(_commandCancellationTokenSource.Token) } if (output is not null) - AddOutput(output, terminalCommandBoundary); + AddOutput(output, terminalCommand, terminalCommandBoundary); DispatchNewStateKey(); }); @@ -492,7 +492,7 @@ await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( }); } - public void AddOutput(string output, TerminalCommandBoundary terminalCommandBoundary) + public void AddOutput(string output, TerminalCommand terminalCommand, TerminalCommandBoundary terminalCommandBoundary) { _textEditorService.PostIndependent( nameof(EnqueueCommandAsync), @@ -509,7 +509,10 @@ public void AddOutput(string output, TerminalCommandBoundary terminalCommandBoun var entryPositionIndex = modelModifier.GetPositionIndex(primaryCursorModifier); terminalCommandBoundary.StartPositionIndexInclusive ??= entryPositionIndex; - var outputTextSpans = DotNetRunOutputParser.Parse(output); + var outputTextSpanList = new List(); + + if (terminalCommand.ParseFunc is not null) + outputTextSpanList = terminalCommand.ParseFunc.Invoke(output); await _textEditorService.ModelApi.InsertTextFactory( ResourceUri, @@ -523,7 +526,7 @@ await _textEditorService.ModelApi.InsertTextFactory( if (terminalCompilerService.GetCompilerServiceResourceFor(modelModifier.ResourceUri) is not TerminalResource terminalResource) return; - outputTextSpans = outputTextSpans.Select(x => x with + outputTextSpanList = outputTextSpanList.Select(x => x with { StartingIndexInclusive = entryPositionIndex + x.StartingIndexInclusive, EndingIndexExclusive = entryPositionIndex + x.EndingIndexExclusive, @@ -531,8 +534,8 @@ await _textEditorService.ModelApi.InsertTextFactory( SourceText = modelModifier.GetAllText(), }).ToList(); - terminalResource.ManualDecorationTextSpanList.AddRange(outputTextSpans); - terminalResource.ManualSymbolList.AddRange(outputTextSpans.Select(x => new SourceFileSymbol(x))); + terminalResource.ManualDecorationTextSpanList.AddRange(outputTextSpanList); + terminalResource.ManualSymbolList.AddRange(outputTextSpanList.Select(x => new SourceFileSymbol(x))); await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( modelModifier.ResourceUri, diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs index 8cf0acfb4..f9439ad34 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs @@ -1,5 +1,6 @@ using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Ide.RazorLib.CommandLines.Models; +using Luthetus.TextEditor.RazorLib.Lexes.Models; namespace Luthetus.Ide.RazorLib.Terminals.Models; @@ -9,4 +10,5 @@ public record TerminalCommand( string? ChangeWorkingDirectoryTo = null, CancellationToken CancellationToken = default, Func? ContinueWith = null, - Func? BeginWith = null); + Func? BeginWith = null, + Func>? ParseFunc = null); From 530fe7447627f16a9cb3b1e21da10979d4fabb19 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 15:55:09 -0400 Subject: [PATCH 30/56] GitCli parser progress --- .../Gits/Displays/GitControlsDisplay.razor.cs | 6 +- .../Terminals/Models/GitCliOutputParser.cs | 155 ++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index e073a1380..cb641cc0f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -12,6 +12,8 @@ public partial class GitControlsDisplay : ComponentBase { [Inject] private IState TerminalStateWrap { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; [CascadingParameter] public GitState GitState { get; set; } = null!; @@ -31,11 +33,13 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() GitCliFacts.TARGET_FILE_NAME, new string[] { GitCliFacts.STATUS_COMMAND }); + var gitCliOutputParser = new GitCliOutputParser(Dispatcher, GitState); + var gitStatusCommand = new TerminalCommand( NewDotNetSolutionTerminalCommandKey, formattedCommand, parentDirectory.Value, - CancellationToken.None); + ParseFunc: gitCliOutputParser.Parse); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitStatusCommand); diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs new file mode 100644 index 000000000..3705ece39 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -0,0 +1,155 @@ +using Fluxor; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.TextEditor.RazorLib.CompilerServices.Facts; +using Luthetus.TextEditor.RazorLib.CompilerServices.Utility; +using Luthetus.TextEditor.RazorLib.Lexes.Models; +using System.Linq; + +namespace Luthetus.Ide.RazorLib.Terminals.Models; + +public class GitCliOutputParser +{ + private readonly IDispatcher _dispatcher; + private readonly GitState _gitState; + + public GitCliOutputParser(IDispatcher dispatcher, GitState gitState) + { + _dispatcher = dispatcher; + _gitState = gitState; + } + + private StageKind _stageKind = StageKind.None; + + public List Parse(string output) + { + var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); + + var textSpanList = new List(); + + TextEditorTextSpan errorKeywordAndErrorCodeTextSpan = new(0, 0, 0, new ResourceUri(string.Empty), string.Empty); + + + + while (!stringWalker.IsEof) + { + if (_stageKind == StageKind.None) + { + // Find: "Untracked files:" + if (stringWalker.CurrentCharacter == 'U' && stringWalker.PeekForSubstring("Untracked files:")) + { + var startPositionInclusive = stringWalker.PositionIndex; + + // Read: "Untracked files:" (literally) + while (!stringWalker.IsEof) + { + var character = stringWalker.ReadCharacter(); + + if (character == ':') + { + textSpanList.Add(new TextEditorTextSpan( + startPositionInclusive, + stringWalker, + (byte)TerminalDecorationKind.Warning)); + + _stageKind = StageKind.IsReadingUntrackedFiles; + break; + } + } + } + } + else if (_stageKind == StageKind.IsReadingUntrackedFiles) + { + // Find: "(use \"git add ...\" to include in what will be committed)" + while (!stringWalker.IsEof) + { + var targetString = "(use \"git add ...\" to include in what will be committed)"; + var targetStringFirstCharacter = targetString.First(); + + if (stringWalker.CurrentCharacter == targetStringFirstCharacter && + stringWalker.PeekForSubstring(targetString)) + { + var startPositionInclusive = stringWalker.PositionIndex; + + // Read: "(use \"git add ...\" to include in what will be committed)" (literally) + while (!stringWalker.IsEof) + { + var character = stringWalker.ReadCharacter(); + + if (character == ')') + { + textSpanList.Add(new TextEditorTextSpan( + startPositionInclusive, + stringWalker, + (byte)TerminalDecorationKind.Comment)); + + break; + } + } + + break; + } + else if (!WhitespaceFacts.ALL_LIST.Contains(stringWalker.CurrentCharacter)) + { + // If the '(' was not found, + // yet the stringWalker.CurrentCharacter is non-whitespace, + // Then for whatever reason the "(use \"git add ...\" to include in what will be committed)" + // text was not written out. Perhaps the CLI is going straight into listing the untracked files? + break; + } + + _ = stringWalker.ReadCharacter(); + } + + //// Read each untracked file + //while (!stringWalker.IsEof) + //{ + // var character = stringWalker.ReadCharacter(); + + // if (character == ':') + // { + // textSpanList.Add(new TextEditorTextSpan( + // startPositionInclusive, + // stringWalker, + // (byte)TerminalDecorationKind.Warning)); + + // break; + // } + //} + } + + + _ = stringWalker.ReadCharacter(); + } + + if (errorKeywordAndErrorCodeTextSpan.DecorationByte != 0) + { + for (int i = textSpanList.Count - 1; i >= 0; i--) + { + textSpanList[i] = textSpanList[i] with + { + DecorationByte = errorKeywordAndErrorCodeTextSpan.DecorationByte + }; + } + } + + //_dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + //{ + // if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) + // { + // // Git folder was changed while the text was being parsed, + // // throw away the result since it is thereby invalid. + // return inState; + // } + // + // inState.GitFilesList.Add(new GitFile()); + //})); + + return textSpanList; + } + + private enum StageKind + { + None, + IsReadingUntrackedFiles, + } +} \ No newline at end of file From 82e1570e6a301a19948f331210f4adb38e1e03cd Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 16:19:13 -0400 Subject: [PATCH 31/56] Update GitCliOutputParser.cs --- .../Terminals/Models/GitCliOutputParser.cs | 62 ++++++++++++------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index 3705ece39..41c45b540 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -59,43 +59,59 @@ public List Parse(string output) } else if (_stageKind == StageKind.IsReadingUntrackedFiles) { - // Find: "(use \"git add ...\" to include in what will be committed)" while (!stringWalker.IsEof) { - var targetString = "(use \"git add ...\" to include in what will be committed)"; - var targetStringFirstCharacter = targetString.First(); - - if (stringWalker.CurrentCharacter == targetStringFirstCharacter && - stringWalker.PeekForSubstring(targetString)) + + if (stringWalker.CurrentCharacter == ' ' && stringWalker.NextCharacter == ' ') { - var startPositionInclusive = stringWalker.PositionIndex; - - // Read: "(use \"git add ...\" to include in what will be committed)" (literally) + // Read comments line by line while (!stringWalker.IsEof) { - var character = stringWalker.ReadCharacter(); + if (stringWalker.CurrentCharacter != ' ' || stringWalker.NextCharacter != ' ') + break; + + // Discard the leading whitespace on the line (two spaces) + _ = stringWalker.ReadRange(2); - if (character == ')') + var startPositionInclusive = stringWalker.PositionIndex; + + while (!stringWalker.IsEof && !WhitespaceFacts.LINE_ENDING_CHARACTER_LIST.Contains(stringWalker.CurrentCharacter)) { - textSpanList.Add(new TextEditorTextSpan( - startPositionInclusive, - stringWalker, - (byte)TerminalDecorationKind.Comment)); + _ = stringWalker.ReadCharacter(); + } + textSpanList.Add(new TextEditorTextSpan( + startPositionInclusive, + stringWalker, + (byte)TerminalDecorationKind.Comment)); + } + } + else if (stringWalker.CurrentCharacter == WhitespaceFacts.TAB) + { + // Read untracked files line by line + while (!stringWalker.IsEof) + { + if (stringWalker.CurrentCharacter != WhitespaceFacts.TAB) break; + + // Discard the leading whitespace on the line (one tab) + _ = stringWalker.ReadCharacter(); + + var startPositionInclusive = stringWalker.PositionIndex; + + while (!stringWalker.IsEof && !WhitespaceFacts.LINE_ENDING_CHARACTER_LIST.Contains(stringWalker.CurrentCharacter)) + { + _ = stringWalker.ReadCharacter(); } + + textSpanList.Add(new TextEditorTextSpan( + startPositionInclusive, + stringWalker, + (byte)TerminalDecorationKind.Warning)); } break; } - else if (!WhitespaceFacts.ALL_LIST.Contains(stringWalker.CurrentCharacter)) - { - // If the '(' was not found, - // yet the stringWalker.CurrentCharacter is non-whitespace, - // Then for whatever reason the "(use \"git add ...\" to include in what will be committed)" - // text was not written out. Perhaps the CLI is going straight into listing the untracked files? - break; - } _ = stringWalker.ReadCharacter(); } From 052ee9b3432e90c2b86dcd2b76b789fb2678e602 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 16:36:58 -0400 Subject: [PATCH 32/56] Parse untracked git files --- .../FileSystems/Models/AncestorDirectory.cs | 8 ++ .../Gits/Displays/GitControlsDisplay.razor | 10 +++ .../Gits/Displays/GitControlsDisplay.razor.cs | 9 ++- .../Displays/GitPickGitFolderDisplay.razor.cs | 2 +- .../Ide.RazorLib/Gits/States/GitState.Main.cs | 2 +- .../Ide.RazorLib/Gits/States/GitSync.Tasks.cs | 10 +-- .../Terminals/Models/GitCliOutputParser.cs | 73 ++++++++++--------- .../Basis/Gits/States/GitStateMainTests.cs | 2 +- 8 files changed, 74 insertions(+), 42 deletions(-) diff --git a/Source/Lib/Common/FileSystems/Models/AncestorDirectory.cs b/Source/Lib/Common/FileSystems/Models/AncestorDirectory.cs index cfe15c664..f17efea48 100644 --- a/Source/Lib/Common/FileSystems/Models/AncestorDirectory.cs +++ b/Source/Lib/Common/FileSystems/Models/AncestorDirectory.cs @@ -1,5 +1,13 @@ namespace Luthetus.Common.RazorLib.FileSystems.Models; +/// +/// This class exists alongside the type. +/// This is intentional, as if one treats an ancestor directory as an , +/// then far more "metadata" gets created.

+/// +/// This class allows for tracking of ancestor directories efficiently, +/// and if there is one of interest, then choose to create an from it. +///
public class AncestorDirectory { public AncestorDirectory( diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor index 6395fa931..82196129e 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -1,6 +1,16 @@
+ + @{ var localGitState = GitState; } + + +
+ @foreach (var gitFile in localGitState.GitFileList) + { +
@gitFile.AbsolutePath.Value|@gitFile.GitDirtyReason
+ } +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index cb641cc0f..5265b1d05 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -1,4 +1,5 @@ using Fluxor; +using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Ide.RazorLib.CommandLines.Models; using Luthetus.Ide.RazorLib.Gits.States; @@ -14,6 +15,8 @@ public partial class GitControlsDisplay : ComponentBase private IState TerminalStateWrap { get; set; } = null!; [Inject] private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; [CascadingParameter] public GitState GitState { get; set; } = null!; @@ -33,7 +36,11 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() GitCliFacts.TARGET_FILE_NAME, new string[] { GitCliFacts.STATUS_COMMAND }); - var gitCliOutputParser = new GitCliOutputParser(Dispatcher, GitState); + var gitCliOutputParser = new GitCliOutputParser( + Dispatcher, + GitState, + EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), + EnvironmentProvider); var gitStatusCommand = new TerminalCommand( NewDotNetSolutionTerminalCommandKey, diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 2213aab5f..72738c373 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -54,7 +54,7 @@ private void ConfirmGitFolderOnClick() { GitFolderAbsolutePath = EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true), ActiveGitTasks = ImmutableList.Empty, - GitFilesList = ImmutableList.Empty, + GitFileList = ImmutableList.Empty, })); } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 4645d4e00..1fc55b794 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -16,7 +16,7 @@ namespace Luthetus.Ide.RazorLib.Gits.States; [FeatureState] public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, - ImmutableList GitFilesList, + ImmutableList GitFileList, ImmutableList ActiveGitTasks) { public GitState() : this(null, ImmutableList.Empty, ImmutableList.Empty) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs index dcc3e1766..7e4e9b6d1 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs @@ -34,7 +34,7 @@ private async Task RefreshGitAsync(CancellationToken cancellationToken) // without realizing the other was also part of the Dispatch replacement. Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => inGitState with { - GitFilesList = ImmutableList.Empty + GitFileList = ImmutableList.Empty })); if (gitState.GitFolderAbsolutePath is null || @@ -93,8 +93,8 @@ void UntrackedFilesOnAfterCompletedAction(ImmutableList gitFiles) { Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => { - var nextGitFilesList = inGitState.GitFilesList.AddRange(gitFiles); - return inGitState with { GitFilesList = nextGitFilesList }; + var nextGitFilesList = inGitState.GitFileList.AddRange(gitFiles); + return inGitState with { GitFileList = nextGitFilesList }; })); } @@ -102,8 +102,8 @@ void ChangesNotStagedOnAfterCompletedAction(ImmutableList gitFiles) { Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => { - var nextGitFilesList = inGitState.GitFilesList.AddRange(gitFiles); - return inGitState with { GitFilesList = nextGitFilesList }; + var nextGitFilesList = inGitState.GitFileList.AddRange(gitFiles); + return inGitState with { GitFileList = nextGitFilesList }; })); } } diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index 41c45b540..f7d781b45 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -1,9 +1,11 @@ using Fluxor; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.TextEditor.RazorLib.CompilerServices.Facts; using Luthetus.TextEditor.RazorLib.CompilerServices.Utility; using Luthetus.TextEditor.RazorLib.Lexes.Models; -using System.Linq; +using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Terminals.Models; @@ -11,11 +13,20 @@ public class GitCliOutputParser { private readonly IDispatcher _dispatcher; private readonly GitState _gitState; - - public GitCliOutputParser(IDispatcher dispatcher, GitState gitState) + private readonly IAbsolutePath _workingDirectory; + private readonly IEnvironmentProvider _environmentProvider; + private readonly List _gitFileList = new(); + + public GitCliOutputParser( + IDispatcher dispatcher, + GitState gitState, + IAbsolutePath workingDirectory, + IEnvironmentProvider environmentProvider) { _dispatcher = dispatcher; _gitState = gitState; + _workingDirectory = workingDirectory; + _environmentProvider = environmentProvider; } private StageKind _stageKind = StageKind.None; @@ -104,10 +115,20 @@ public List Parse(string output) _ = stringWalker.ReadCharacter(); } - textSpanList.Add(new TextEditorTextSpan( + var textSpan = new TextEditorTextSpan( startPositionInclusive, stringWalker, - (byte)TerminalDecorationKind.Warning)); + (byte)TerminalDecorationKind.Warning); + textSpanList.Add(textSpan); + + var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( + _workingDirectory, + textSpan.GetText(), + _environmentProvider); + + var absolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, false); + + _gitFileList.Add(new GitFile(absolutePath, GitDirtyReason.Untracked)); } break; @@ -115,25 +136,8 @@ public List Parse(string output) _ = stringWalker.ReadCharacter(); } - - //// Read each untracked file - //while (!stringWalker.IsEof) - //{ - // var character = stringWalker.ReadCharacter(); - - // if (character == ':') - // { - // textSpanList.Add(new TextEditorTextSpan( - // startPositionInclusive, - // stringWalker, - // (byte)TerminalDecorationKind.Warning)); - - // break; - // } - //} } - _ = stringWalker.ReadCharacter(); } @@ -148,17 +152,20 @@ public List Parse(string output) } } - //_dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => - //{ - // if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) - // { - // // Git folder was changed while the text was being parsed, - // // throw away the result since it is thereby invalid. - // return inState; - // } - // - // inState.GitFilesList.Add(new GitFile()); - //})); + _dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + { + if (inState.GitFolderAbsolutePath != _gitState.GitFolderAbsolutePath) + { + // Git folder was changed while the text was being parsed, + // throw away the result since it is thereby invalid. + return inState; + } + + return inState with + { + GitFileList = _gitFileList.ToImmutableList() + }; + })); return textSpanList; } diff --git a/Source/Tests/Ide/Basis/Gits/States/GitStateMainTests.cs b/Source/Tests/Ide/Basis/Gits/States/GitStateMainTests.cs index ce9b04d68..fba2164fb 100644 --- a/Source/Tests/Ide/Basis/Gits/States/GitStateMainTests.cs +++ b/Source/Tests/Ide/Basis/Gits/States/GitStateMainTests.cs @@ -14,7 +14,7 @@ public class GitStateMainTests /// ///
----
/// - /// + /// /// /// [Fact] From a178956af94eaaf40e1506643b5b5af648cd9219 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 17:40:01 -0400 Subject: [PATCH 33/56] TreeView from git cli --- .../States/CodeSearchState.Effector.cs | 10 +++ .../Gits/Displays/GitChangesContextMenu.razor | 14 +++ .../Displays/GitChangesContextMenu.razor.cs | 90 +++++++++++++++++++ .../Displays/GitChangesTreeViewDisplay.razor | 31 +++++++ .../GitChangesTreeViewDisplay.razor.cs | 58 ++++++++++++ .../Gits/Displays/GitControlsDisplay.razor | 7 +- .../Gits/States/GitState.Actions.cs | 10 ++- .../Gits/States/GitState.Effector.cs | 77 ++++++++++++++++ .../Ide.RazorLib/Gits/States/GitState.Main.cs | 12 +-- .../Gits/States/GitState.Reducer.cs | 22 ++++- .../Terminals/Models/GitCliOutputParser.cs | 45 +++------- .../Displays/TreeViewGitFileDisplay.razor | 40 +++------ .../Displays/TreeViewGitFileDisplay.razor.cs | 12 +-- .../Models/TreeViewGitFile.cs | 22 ++--- 14 files changed, 347 insertions(+), 103 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/CodeSearches/States/CodeSearchState.Effector.cs b/Source/Lib/Ide/Ide.RazorLib/CodeSearches/States/CodeSearchState.Effector.cs index 46f2ccae1..1c19573c0 100644 --- a/Source/Lib/Ide/Ide.RazorLib/CodeSearches/States/CodeSearchState.Effector.cs +++ b/Source/Lib/Ide/Ide.RazorLib/CodeSearches/States/CodeSearchState.Effector.cs @@ -24,6 +24,16 @@ public Effector( _fileSystemProvider = fileSystemProvider; } + /// + /// TODO: This method makes use of and yet is accessing... + /// ...searchEffect.CancellationToken. + /// The issue here is that the search effect parameter to this method + /// could be out of date by the time that the throttle delay is completed. + /// This should be fixed. (2024-05-02) + /// + /// + /// + /// [EffectMethod] public Task HandleSearchEffect( SearchEffect searchEffect, diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor new file mode 100644 index 000000000..810dd8630 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor @@ -0,0 +1,14 @@ +@using Luthetus.Common.RazorLib.Menus.Displays + +@{ var localMenuRecord = _menuRecord; } + +@if (localMenuRecord is null) +{ + // TODO: Should something be displayed while the MenuRecord is loading? +} +else +{ + + + +} diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs new file mode 100644 index 000000000..7dbc25c99 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs @@ -0,0 +1,90 @@ +using Fluxor; +using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; +using Luthetus.Ide.RazorLib.Terminals.States; +using Luthetus.Common.RazorLib.Commands.Models; +using Luthetus.Common.RazorLib.Menus.Models; +using Luthetus.Common.RazorLib.Dropdowns.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Common.RazorLib.Dimensions.Models; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; +using Luthetus.Ide.RazorLib.CommandLines.Models; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using System.Text; +using Luthetus.Ide.RazorLib.Gits.States; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitChangesContextMenu : ComponentBase +{ + [Inject] + private IState TerminalStateWrap { get; set; } = null!; + [Inject] + private IBackgroundTaskService BackgroundTaskService { get; set; } = null!; + + [CascadingParameter] + public GitState GitState { get; set; } = null!; + + [Parameter, EditorRequired] + public TreeViewCommandArgs TreeViewCommandArgs { get; set; } = null!; + + public static readonly Key ContextMenuEventDropdownKey = Key.NewKey(); + + private MenuRecord? _menuRecord = null; + + protected override async Task OnInitializedAsync() + { + // Usage of 'OnInitializedAsync' lifecycle method ensure the context menu is only rendered once. + // Otherwise, one might have the context menu's options change out from under them. + _menuRecord = await GetMenuRecord(TreeViewCommandArgs); + await InvokeAsync(StateHasChanged); + + await base.OnInitializedAsync(); + } + + private async Task GetMenuRecord(TreeViewCommandArgs commandArgs, bool isRecursiveCall = false) + { + if (!isRecursiveCall && commandArgs.TreeViewContainer.SelectedNodeList.Count > 1) + { + return await GetMultiSelectionMenuRecord(commandArgs); + } + + if (commandArgs.NodeThatReceivedMouseEvent is null) + return MenuRecord.Empty; + + var menuRecordsList = new List(); + + if (!menuRecordsList.Any()) + return MenuRecord.Empty; + + return new MenuRecord(menuRecordsList.ToImmutableArray()); + } + + private async Task GetMultiSelectionMenuRecord(TreeViewCommandArgs commandArgs) + { + var menuOptionRecordList = new List(); + Func runAllOnClicksWithinSelection = () => Task.CompletedTask; + bool runAllOnClicksWithinSelectionHasEffect = false; + + if (!menuOptionRecordList.Any()) + return MenuRecord.Empty; + + return new MenuRecord(menuOptionRecordList.ToImmutableArray()); + } + + + public static string GetContextMenuCssStyleString(TreeViewCommandArgs? commandArgs) + { + if (commandArgs?.ContextMenuFixedPosition is null) + return "display: none;"; + + var left = + $"left: {commandArgs.ContextMenuFixedPosition.LeftPositionInPixels.ToCssValue()}px;"; + + var top = + $"top: {commandArgs.ContextMenuFixedPosition.TopPositionInPixels.ToCssValue()}px;"; + + return $"{left} {top}"; + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor new file mode 100644 index 000000000..a28276250 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor @@ -0,0 +1,31 @@ +@using Luthetus.Common.RazorLib.Dropdowns.Displays +@using Luthetus.Common.RazorLib.Dropdowns.Models +@using Luthetus.Common.RazorLib.TreeViews.Displays +@using Luthetus.Common.RazorLib.TreeViews.Models +@using Luthetus.Ide.RazorLib.Terminals.Models +@using System.Collections.Immutable + +
+ + @{ var appOptionsState = AppOptionsStateWrap.Value; } + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs new file mode 100644 index 000000000..3f0cc7809 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs @@ -0,0 +1,58 @@ +using Fluxor; +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using Luthetus.Common.RazorLib.Commands.Models; +using Luthetus.Common.RazorLib.Dropdowns.States; +using Luthetus.Common.RazorLib.Options.States; +using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Microsoft.AspNetCore.Components; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitChangesTreeViewDisplay : ComponentBase +{ + [Inject] + private ITreeViewService TreeViewService { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IState AppOptionsStateWrap { get; set; } = null!; + [Inject] + private IBackgroundTaskService BackgroundTaskService { get; set; } = null!; + + [CascadingParameter] + public GitState GitState { get; set; } = null!; + + private TreeViewCommandArgs? _mostRecentTreeViewCommandArgs; + private TreeViewKeyboardEventHandler _treeViewKeyboardEventHandler = null!; + private TreeViewMouseEventHandler _treeViewMouseEventHandler = null!; + + private int OffsetPerDepthInPixels => (int)Math.Ceiling( + AppOptionsStateWrap.Value.Options.IconSizeInPixels * (2.0 / 3.0)); + + protected override void OnInitialized() + { + _treeViewKeyboardEventHandler = new TreeViewKeyboardEventHandler( + TreeViewService, + BackgroundTaskService); + + _treeViewMouseEventHandler = new TreeViewMouseEventHandler( + TreeViewService, + BackgroundTaskService); + + base.OnInitialized(); + } + + private async Task OnTreeViewContextMenuFunc(TreeViewCommandArgs treeViewCommandArgs) + { + _mostRecentTreeViewCommandArgs = treeViewCommandArgs; + + // The order of 'StateHasChanged(...)' and 'AddActiveDropdownKey(...)' is important. + // The ChildContent renders nothing, unless the provider of the child content + // re-renders now that there is a given '_mostRecentTreeViewContextMenuCommandArgs' + await InvokeAsync(StateHasChanged); + + Dispatcher.Dispatch(new DropdownState.AddActiveAction( + GitChangesContextMenu.ContextMenuEventDropdownKey)); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor index 82196129e..a24120b2f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -7,10 +7,5 @@ Status -
- @foreach (var gitFile in localGitState.GitFileList) - { -
@gitFile.AbsolutePath.Value|@gitFile.GitDirtyReason
- } -
+ \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs index 23e381cbc..62dc3b819 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs @@ -1,6 +1,14 @@ -namespace Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Ide.RazorLib.Gits.Models; +using System.Collections.Immutable; + +namespace Luthetus.Ide.RazorLib.Gits.States; public partial record GitState { + /// + /// If the expected path is not the actual path, then the git file list will NOT be changed. + /// + public record SetGitFileListAction(IAbsolutePath ExpectedGitFolderAbsolutePath, ImmutableList GitFileList); public record SetGitStateWithAction(Func GitStateWithFunc); } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs new file mode 100644 index 000000000..5dd4b2d47 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs @@ -0,0 +1,77 @@ +using Fluxor; +using Luthetus.Common.RazorLib.Reactives.Models; +using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.ComponentRenderers.Models; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; +using System.Collections.Immutable; + +namespace Luthetus.Ide.RazorLib.Gits.States; + +public partial record GitState +{ + public class Effector + { + private readonly IState _gitStateWrap; + private readonly ILuthetusIdeComponentRenderers _ideComponentRenderers; + private readonly ITreeViewService _treeViewService; + private readonly IThrottle _throttle = new Throttle(TimeSpan.FromMilliseconds(300)); + + public Effector( + IState gitStateWrap, + ILuthetusIdeComponentRenderers ideComponentRenderers, + ITreeViewService treeViewService) + { + _gitStateWrap = gitStateWrap; + _ideComponentRenderers = ideComponentRenderers; + _treeViewService = treeViewService; + } + + [EffectMethod(typeof(SetGitFileListAction))] + public Task HandleSetGitStateWithAction(IDispatcher dispatcher) + { + // Suppress unused variable warning + _ = dispatcher; + + _throttle.PushEvent(_ => + { + var gitState = _gitStateWrap.Value; + + var treeViewList = gitState.GitFileList.Select(x => new TreeViewGitFile( + x, + _ideComponentRenderers, + false, + false)) + .ToArray(); + + var adhocRoot = TreeViewAdhoc.ConstructTreeViewAdhoc(treeViewList); + var firstNode = treeViewList.FirstOrDefault(); + + var activeNodes = firstNode is null + ? Array.Empty() + : new[] { firstNode }; + + if (!_treeViewService.TryGetTreeViewContainer(TreeViewGitChangesKey, out var container)) + { + _treeViewService.RegisterTreeViewContainer(new TreeViewContainer( + TreeViewGitChangesKey, + adhocRoot, + activeNodes.ToImmutableList())); + } + else + { + _treeViewService.SetRoot(TreeViewGitChangesKey, adhocRoot); + + _treeViewService.SetActiveNode( + TreeViewGitChangesKey, + firstNode, + true, + false); + } + + return Task.CompletedTask; + }); + + return Task.CompletedTask; + } + } +} diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 1fc55b794..48ad4c60b 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -1,24 +1,20 @@ using Fluxor; using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Common.RazorLib.TreeViews.Models; using Luthetus.Ide.RazorLib.Gits.Models; using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Gits.States; -/// -/// The Folder, ".git" may be in the following locations:
-/// -In the context of .NET:
-/// --The folder containing the user selected .NET Solution
-/// --The folder containing the user selected C# Project which is being contained in an adhoc .NET Solution
-/// -In the context of using the folder explorer
-/// --The folder which is user selected.
-///
[FeatureState] public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, ImmutableList GitFileList, ImmutableList ActiveGitTasks) { + public static readonly Key TreeViewGitChangesKey = Key.NewKey(); + public GitState() : this(null, ImmutableList.Empty, ImmutableList.Empty) { diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index cc2ad45d8..3165579b4 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -6,12 +6,30 @@ public partial record GitState { public class Reducer { + [ReducerMethod] + public static GitState ReduceSetGitFileListAction( + GitState inState, + SetGitFileListAction setGitFileListAction) + { + if (inState.GitFolderAbsolutePath != setGitFileListAction.ExpectedGitFolderAbsolutePath) + { + // Git folder was changed while the text was being parsed, + // throw away the result since it is thereby invalid. + return inState; + } + + return inState with + { + GitFileList = setGitFileListAction.GitFileList + }; + } + [ReducerMethod] public static GitState ReduceSetGitStateWithAction( - GitState inGitState, + GitState inState, SetGitStateWithAction setGitStateWithAction) { - return setGitStateWithAction.GitStateWithFunc.Invoke(inGitState); + return setGitStateWithAction.GitStateWithFunc.Invoke(inState); } } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index f7d781b45..f66598366 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -33,14 +33,12 @@ public GitCliOutputParser( public List Parse(string output) { - var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); + if (_gitState.GitFolderAbsolutePath is null) + return new(); + var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); var textSpanList = new List(); - TextEditorTextSpan errorKeywordAndErrorCodeTextSpan = new(0, 0, 0, new ResourceUri(string.Empty), string.Empty); - - - while (!stringWalker.IsEof) { if (_stageKind == StageKind.None) @@ -121,12 +119,17 @@ public List Parse(string output) (byte)TerminalDecorationKind.Warning); textSpanList.Add(textSpan); + var text = textSpan.GetText(); + var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( _workingDirectory, - textSpan.GetText(), + text, _environmentProvider); - var absolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, false); + var isDirectory = text.EndsWith(_environmentProvider.DirectorySeparatorChar) || + text.EndsWith(_environmentProvider.AltDirectorySeparatorChar); + + var absolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, isDirectory); _gitFileList.Add(new GitFile(absolutePath, GitDirtyReason.Untracked)); } @@ -141,31 +144,9 @@ public List Parse(string output) _ = stringWalker.ReadCharacter(); } - if (errorKeywordAndErrorCodeTextSpan.DecorationByte != 0) - { - for (int i = textSpanList.Count - 1; i >= 0; i--) - { - textSpanList[i] = textSpanList[i] with - { - DecorationByte = errorKeywordAndErrorCodeTextSpan.DecorationByte - }; - } - } - - _dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => - { - if (inState.GitFolderAbsolutePath != _gitState.GitFolderAbsolutePath) - { - // Git folder was changed while the text was being parsed, - // throw away the result since it is thereby invalid. - return inState; - } - - return inState with - { - GitFileList = _gitFileList.ToImmutableList() - }; - })); + _dispatcher.Dispatch(new GitState.SetGitFileListAction( + _gitState.GitFolderAbsolutePath, + _gitFileList.ToImmutableList())); return textSpanList; } diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor index 109dd84dc..c369c4ccd 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor @@ -1,33 +1,13 @@ -@using Luthetus.Ide.RazorLib.FileSystems.Displays + -@inherits Fluxor.Blazor.Web.Components.FluxorComponent + @{ var nameWithExtension = TreeViewGitFile.Item.AbsolutePath.NameWithExtension; } -@{ - var gitFile = TreeViewGitFile.Item; - var cssClass = "luth_ide_git-file"; -} - -
- - @{ - var gitState = GitStateWrap.Value; - - string shortenedParentDirectoryPathString = gitFile.AbsolutePath.Value; - - if (gitFile.AbsolutePath.ParentDirectory is not null && - gitState.GitFolderAbsolutePath?.ParentDirectory is not null) - { - } + @if (string.IsNullOrWhiteSpace(nameWithExtension)) + { + @: abc123 } - - - - - @gitFile.AbsolutePath.NameWithExtension - - - - @shortenedParentDirectoryPathString - -
+ else + { + @nameWithExtension + } +
diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs index 75f0c3fa4..5019596c9 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs @@ -1,21 +1,11 @@ -using Fluxor; -using Fluxor.Blazor.Web.Components; -using Luthetus.Common.RazorLib.TreeViews.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; -using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Microsoft.AspNetCore.Components; namespace Luthetus.Ide.RazorLib.TreeViewImplementations.Displays; -public partial class TreeViewGitFileDisplay : FluxorComponent, ITreeViewGitFileRendererType +public partial class TreeViewGitFileDisplay : ComponentBase, ITreeViewGitFileRendererType { - [Inject] - private IState GitStateWrap { get; set; } = null!; - - [CascadingParameter] - public TreeViewContainer TreeViewState { get; set; } = null!; - [Parameter, EditorRequired] public TreeViewGitFile TreeViewGitFile { get; set; } = null!; } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs index f5a0767bb..9a46ef8d7 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs @@ -6,24 +6,25 @@ namespace Luthetus.Ide.RazorLib.TreeViewImplementations.Models; public class TreeViewGitFile : TreeViewWithType { + private readonly ILuthetusIdeComponentRenderers _ideComponentRenderers; + public TreeViewGitFile( - GitFile gitFile, + GitFile item, ILuthetusIdeComponentRenderers ideComponentRenderers, bool isExpandable, bool isExpanded) - : base(gitFile, isExpandable, isExpanded) + : base(item, isExpandable, isExpanded) { - IdeComponentRenderers = ideComponentRenderers; + _ideComponentRenderers = ideComponentRenderers; } - public ILuthetusIdeComponentRenderers IdeComponentRenderers { get; } - public override bool Equals(object? obj) { if (obj is not TreeViewGitFile treeViewGitFile) return false; - return treeViewGitFile.Item.AbsolutePath.Value == Item.AbsolutePath.Value; + return treeViewGitFile.Item.AbsolutePath.Value == + Item.AbsolutePath.Value; } public override int GetHashCode() => Item.AbsolutePath.Value.GetHashCode(); @@ -31,7 +32,7 @@ public override bool Equals(object? obj) public override TreeViewRenderer GetTreeViewRenderer() { return new TreeViewRenderer( - IdeComponentRenderers.LuthetusIdeTreeViews.TreeViewGitFileRendererType, + _ideComponentRenderers.LuthetusIdeTreeViews.TreeViewGitFileRendererType, new Dictionary { { @@ -45,9 +46,4 @@ public override Task LoadChildListAsync() { return Task.CompletedTask; } - - public override void RemoveRelatedFilesFromParent(List siblingsAndSelfTreeViews) - { - // This method is meant to do nothing in this case. - } -} \ No newline at end of file +} From a5c93e715509dc9e28e1d56123b89833758ba01b Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 18:04:08 -0400 Subject: [PATCH 34/56] Add: SelectedGitFileList --- .../Displays/GitPickGitFolderDisplay.razor.cs | 8 +--- .../Gits/States/GitState.Actions.cs | 2 + .../Ide.RazorLib/Gits/States/GitState.Main.cs | 4 +- .../Gits/States/GitState.Reducer.cs | 16 ++++++++ .../Displays/TreeViewGitFileDisplay.razor | 4 +- .../Displays/TreeViewGitFileDisplay.razor.cs | 41 +++++++++++++++++++ 6 files changed, 67 insertions(+), 8 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 72738c373..38be3a766 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -50,11 +50,7 @@ private void RequestInputFileForGitFolder() private void ConfirmGitFolderOnClick() { - Dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => inState with - { - GitFolderAbsolutePath = EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true), - ActiveGitTasks = ImmutableList.Empty, - GitFileList = ImmutableList.Empty, - })); + Dispatcher.Dispatch(new GitState.SetGitFolderAction( + EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true))); } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs index 62dc3b819..62dde12b7 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs @@ -10,5 +10,7 @@ public partial record GitState /// If the expected path is not the actual path, then the git file list will NOT be changed. /// public record SetGitFileListAction(IAbsolutePath ExpectedGitFolderAbsolutePath, ImmutableList GitFileList); + public record SetGitFolderAction(IAbsolutePath GitFolderAbsolutePath); + public record SetSelectedGitFileListAction(Func, ImmutableDictionary> SetSelectedGitFileListFunc); public record SetGitStateWithAction(Func GitStateWithFunc); } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 48ad4c60b..7c952bb6f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -11,11 +11,13 @@ namespace Luthetus.Ide.RazorLib.Gits.States; public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, ImmutableList GitFileList, + ImmutableDictionary SelectedGitFileList, ImmutableList ActiveGitTasks) { public static readonly Key TreeViewGitChangesKey = Key.NewKey(); - public GitState() : this(null, ImmutableList.Empty, ImmutableList.Empty) + public GitState() + : this(null, ImmutableList.Empty, ImmutableDictionary.Empty, ImmutableList.Empty) { } diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index 3165579b4..a5f3cfd27 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -1,4 +1,6 @@ using Fluxor; +using Luthetus.Ide.RazorLib.Gits.Models; +using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Gits.States; @@ -24,6 +26,20 @@ public static GitState ReduceSetGitFileListAction( }; } + [ReducerMethod] + public static GitState ReduceSetGitFolderAction( + GitState inState, + SetGitFolderAction setGitFolderAction) + { + return inState with + { + GitFolderAbsolutePath = setGitFolderAction.GitFolderAbsolutePath, + GitFileList = ImmutableList.Empty, + SelectedGitFileList = ImmutableDictionary.Empty, + ActiveGitTasks = ImmutableList.Empty, + }; + } + [ReducerMethod] public static GitState ReduceSetGitStateWithAction( GitState inState, diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor index c369c4ccd..9f355e281 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor @@ -2,9 +2,11 @@ @{ var nameWithExtension = TreeViewGitFile.Item.AbsolutePath.NameWithExtension; } + + @if (string.IsNullOrWhiteSpace(nameWithExtension)) { - @: abc123 + @: string.IsNullOrWhiteSpace(nameWithExtension) } else { diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs index 5019596c9..1fe35eee0 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs @@ -1,11 +1,52 @@ +using Fluxor; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; +using Luthetus.Ide.RazorLib.Gits.Models; +using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.TreeViewImplementations.Displays; public partial class TreeViewGitFileDisplay : ComponentBase, ITreeViewGitFileRendererType { + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + + [CascadingParameter] + public GitState GitState { get; set; } = null!; + [Parameter, EditorRequired] public TreeViewGitFile TreeViewGitFile { get; set; } = null!; + + private bool IsChecked + { + get => GitState.SelectedGitFileList.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); + set + { + var localGitState = GitState; + + Dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + { + if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) + { + // Git folder was changed, throw away the result since it is thereby invalid. + return inState; + } + + var key = TreeViewGitFile.Item.AbsolutePath.Value; + ImmutableDictionary outSelectedGitFileList; + + if (inState.SelectedGitFileList.ContainsKey(key)) + outSelectedGitFileList = inState.SelectedGitFileList.Remove(key); + else + outSelectedGitFileList = inState.SelectedGitFileList.Add(key, TreeViewGitFile.Item); + + return inState with + { + SelectedGitFileList = outSelectedGitFileList + }; + })); + } + } } \ No newline at end of file From a492b6b1c4ce69c8220e534b37a89361e6f65827 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 18:37:39 -0400 Subject: [PATCH 35/56] Git progress --- .../GitChangesTreeViewDisplay.razor.cs | 14 +++- .../Gits/Displays/GitControlsDisplay.razor | 10 +++ .../Gits/Displays/GitControlsDisplay.razor.cs | 8 +++ .../Displays/GitPickGitFolderDisplay.razor.cs | 1 - .../Ide/Ide.RazorLib/Gits/Models/GitFile.cs | 3 +- .../Models/GitTreeViewKeyboardEventHandler.cs | 69 +++++++++++++++++++ .../Ide.RazorLib/Gits/States/GitState.Main.cs | 2 +- .../Gits/States/GitState.Reducer.cs | 2 +- .../Displays/TreeViewGitFileDisplay.razor.cs | 12 ++-- .../Models/TreeViewGitFile.cs | 8 +-- 10 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs index 3f0cc7809..c0e518fbd 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs @@ -4,6 +4,7 @@ using Luthetus.Common.RazorLib.Dropdowns.States; using Luthetus.Common.RazorLib.Options.States; using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Ide.RazorLib.Gits.States; using Microsoft.AspNetCore.Components; @@ -11,6 +12,13 @@ namespace Luthetus.Ide.RazorLib.Gits.Displays; public partial class GitChangesTreeViewDisplay : ComponentBase { + /// + /// Awkwardly, the constructor needs this, + /// meanwhile this component is receiving as a cascading parameter. + /// This should be written differently (2024-05-02). + /// + [Inject] + private IState GitStateWrap { get; set; } = null!; [Inject] private ITreeViewService TreeViewService { get; set; } = null!; [Inject] @@ -32,9 +40,11 @@ public partial class GitChangesTreeViewDisplay : ComponentBase protected override void OnInitialized() { - _treeViewKeyboardEventHandler = new TreeViewKeyboardEventHandler( + _treeViewKeyboardEventHandler = new GitTreeViewKeyboardEventHandler( TreeViewService, - BackgroundTaskService); + BackgroundTaskService, + GitStateWrap, + Dispatcher); _treeViewMouseEventHandler = new TreeViewMouseEventHandler( TreeViewService, diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor index a24120b2f..05d62dc6c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -8,4 +8,14 @@ + + + + \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index 5265b1d05..cf6295eb0 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -21,6 +21,8 @@ public partial class GitControlsDisplay : ComponentBase [CascadingParameter] public GitState GitState { get; set; } = null!; + private string _summary = string.Empty; + public Key NewDotNetSolutionTerminalCommandKey { get; } = Key.NewKey(); private async Task ExecuteGitStatusTerminalCommandOnClick() @@ -51,4 +53,10 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitStatusCommand); } + + private void SubmitOnClick() + { + if (string.IsNullOrWhiteSpace(_summary)) + return; + } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 38be3a766..1b01bb6ac 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -1,6 +1,5 @@ using Fluxor; using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.InputFiles.Models; using Luthetus.Ide.RazorLib.InputFiles.States; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs index 5c9f56198..32c6b7a25 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs @@ -1,5 +1,4 @@ -using Luthetus.Common.RazorLib.Exceptions; -using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Ide.RazorLib.Exceptions; namespace Luthetus.Ide.RazorLib.Gits.Models; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs new file mode 100644 index 000000000..6b2a54281 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs @@ -0,0 +1,69 @@ +using Fluxor; +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using Luthetus.Common.RazorLib.Commands.Models; +using Luthetus.Common.RazorLib.Keyboards.Models; +using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; +using System.Collections.Immutable; + +namespace Luthetus.Ide.RazorLib.Gits.Models; + +public class GitTreeViewKeyboardEventHandler : TreeViewKeyboardEventHandler +{ + private readonly IState _gitStateWrap; + private readonly IDispatcher _dispatcher; + + public GitTreeViewKeyboardEventHandler( + ITreeViewService treeViewService, + IBackgroundTaskService backgroundTaskService, + IState gitStateWrap, + IDispatcher dispatcher) + : base(treeViewService, backgroundTaskService) + { + _gitStateWrap = gitStateWrap; + _dispatcher = dispatcher; + } + + public override void OnKeyDown(TreeViewCommandArgs commandArgs) + { + if (commandArgs.KeyboardEventArgs is null) + return; + + if (commandArgs.KeyboardEventArgs.Code == KeyboardKeyFacts.WhitespaceCodes.SPACE_CODE || + commandArgs.KeyboardEventArgs.Code == KeyboardKeyFacts.WhitespaceCodes.ENTER_CODE) + { + var localGitState = _gitStateWrap.Value; + + _dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + { + if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) + { + // Git folder was changed, throw away the result since it is thereby invalid. + return inState; + } + + var refSelectedGitFileMap = new Dictionary(inState.SelectedGitFileMap); + + foreach (var selectedNode in commandArgs.TreeViewContainer.SelectedNodeList) + { + if (selectedNode is TreeViewGitFile treeViewGitFile) + { + var key = treeViewGitFile.Item.AbsolutePath.Value; + + var wasRemoved = refSelectedGitFileMap.Remove(key); + if (!wasRemoved) + refSelectedGitFileMap.Add(key, treeViewGitFile.Item); + } + } + + return inState with + { + SelectedGitFileMap = refSelectedGitFileMap.ToImmutableDictionary() + }; + })); + } + + base.OnKeyDown(commandArgs); + } +} diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 7c952bb6f..8d73cc152 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -11,7 +11,7 @@ namespace Luthetus.Ide.RazorLib.Gits.States; public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, ImmutableList GitFileList, - ImmutableDictionary SelectedGitFileList, + ImmutableDictionary SelectedGitFileMap, ImmutableList ActiveGitTasks) { public static readonly Key TreeViewGitChangesKey = Key.NewKey(); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index a5f3cfd27..9e1f3c4a3 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -35,7 +35,7 @@ public static GitState ReduceSetGitFolderAction( { GitFolderAbsolutePath = setGitFolderAction.GitFolderAbsolutePath, GitFileList = ImmutableList.Empty, - SelectedGitFileList = ImmutableDictionary.Empty, + SelectedGitFileMap = ImmutableDictionary.Empty, ActiveGitTasks = ImmutableList.Empty, }; } diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs index 1fe35eee0..de1752835 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs @@ -21,7 +21,7 @@ public partial class TreeViewGitFileDisplay : ComponentBase, ITreeViewGitFileRen private bool IsChecked { - get => GitState.SelectedGitFileList.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); + get => GitState.SelectedGitFileMap.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); set { var localGitState = GitState; @@ -35,16 +35,16 @@ private bool IsChecked } var key = TreeViewGitFile.Item.AbsolutePath.Value; - ImmutableDictionary outSelectedGitFileList; + ImmutableDictionary outSelectedGitFileMap; - if (inState.SelectedGitFileList.ContainsKey(key)) - outSelectedGitFileList = inState.SelectedGitFileList.Remove(key); + if (inState.SelectedGitFileMap.ContainsKey(key)) + outSelectedGitFileMap = inState.SelectedGitFileMap.Remove(key); else - outSelectedGitFileList = inState.SelectedGitFileList.Add(key, TreeViewGitFile.Item); + outSelectedGitFileMap = inState.SelectedGitFileMap.Add(key, TreeViewGitFile.Item); return inState with { - SelectedGitFileList = outSelectedGitFileList + SelectedGitFileMap = outSelectedGitFileMap }; })); } diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs index 9a46ef8d7..87ef87da1 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Models/TreeViewGitFile.cs @@ -6,8 +6,6 @@ namespace Luthetus.Ide.RazorLib.TreeViewImplementations.Models; public class TreeViewGitFile : TreeViewWithType { - private readonly ILuthetusIdeComponentRenderers _ideComponentRenderers; - public TreeViewGitFile( GitFile item, ILuthetusIdeComponentRenderers ideComponentRenderers, @@ -15,9 +13,11 @@ public TreeViewGitFile( bool isExpanded) : base(item, isExpandable, isExpanded) { - _ideComponentRenderers = ideComponentRenderers; + IdeComponentRenderers = ideComponentRenderers; } + public ILuthetusIdeComponentRenderers IdeComponentRenderers { get; } + public override bool Equals(object? obj) { if (obj is not TreeViewGitFile treeViewGitFile) @@ -32,7 +32,7 @@ public override bool Equals(object? obj) public override TreeViewRenderer GetTreeViewRenderer() { return new TreeViewRenderer( - _ideComponentRenderers.LuthetusIdeTreeViews.TreeViewGitFileRendererType, + IdeComponentRenderers.LuthetusIdeTreeViews.TreeViewGitFileRendererType, new Dictionary { { From e2ea825fec497c785b6a893b1ab52dadd06dabfe Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 19:08:19 -0400 Subject: [PATCH 36/56] Git add --- .../Gits/Displays/GitControlsDisplay.razor | 2 +- .../Gits/Displays/GitControlsDisplay.razor.cs | 37 ++++++++++++++++++- .../Models/GitTreeViewKeyboardEventHandler.cs | 8 ++-- .../Ide.RazorLib/Gits/States/GitState.Main.cs | 2 +- .../Gits/States/GitState.Reducer.cs | 2 +- .../Displays/TreeViewGitFileDisplay.razor.cs | 12 +++--- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor index 05d62dc6c..9aced2e1b 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -15,7 +15,7 @@ @bind:event="oninput" /> \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index cf6295eb0..435d04f15 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -6,6 +6,7 @@ using Luthetus.Ide.RazorLib.Terminals.Models; using Luthetus.Ide.RazorLib.Terminals.States; using Microsoft.AspNetCore.Components; +using System.Text; namespace Luthetus.Ide.RazorLib.Gits.Displays; @@ -54,9 +55,43 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() await generalTerminal.EnqueueCommandAsync(gitStatusCommand); } - private void SubmitOnClick() + private async Task SubmitOnClick(GitState localGitState) { if (string.IsNullOrWhiteSpace(_summary)) return; + + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + + var filesBuilder = new StringBuilder(); + + foreach (var fileAbsolutePath in localGitState.StagedGitFileMap.Values) + { + var relativePathString = PathHelper.GetRelativeFromTwoAbsolutes( + EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), + fileAbsolutePath.AbsolutePath, + EnvironmentProvider); + + filesBuilder.Append($"\"{relativePathString}\" "); + } + + var argumentsString = "add " + filesBuilder.ToString(); + + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { argumentsString }) + { + HACK_ArgumentsString = argumentsString + }; + + var gitAddCommand = new TerminalCommand( + NewDotNetSolutionTerminalCommandKey, + formattedCommand, + parentDirectory.Value); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitAddCommand); } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs index 6b2a54281..f26ec8b03 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs @@ -43,7 +43,7 @@ public override void OnKeyDown(TreeViewCommandArgs commandArgs) return inState; } - var refSelectedGitFileMap = new Dictionary(inState.SelectedGitFileMap); + var outStagedGitFileMap = new Dictionary(inState.StagedGitFileMap); foreach (var selectedNode in commandArgs.TreeViewContainer.SelectedNodeList) { @@ -51,15 +51,15 @@ public override void OnKeyDown(TreeViewCommandArgs commandArgs) { var key = treeViewGitFile.Item.AbsolutePath.Value; - var wasRemoved = refSelectedGitFileMap.Remove(key); + var wasRemoved = outStagedGitFileMap.Remove(key); if (!wasRemoved) - refSelectedGitFileMap.Add(key, treeViewGitFile.Item); + outStagedGitFileMap.Add(key, treeViewGitFile.Item); } } return inState with { - SelectedGitFileMap = refSelectedGitFileMap.ToImmutableDictionary() + StagedGitFileMap = outStagedGitFileMap.ToImmutableDictionary() }; })); } diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 8d73cc152..659ba9237 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -11,7 +11,7 @@ namespace Luthetus.Ide.RazorLib.Gits.States; public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, ImmutableList GitFileList, - ImmutableDictionary SelectedGitFileMap, + ImmutableDictionary StagedGitFileMap, ImmutableList ActiveGitTasks) { public static readonly Key TreeViewGitChangesKey = Key.NewKey(); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index 9e1f3c4a3..6dcc5d05f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -35,7 +35,7 @@ public static GitState ReduceSetGitFolderAction( { GitFolderAbsolutePath = setGitFolderAction.GitFolderAbsolutePath, GitFileList = ImmutableList.Empty, - SelectedGitFileMap = ImmutableDictionary.Empty, + StagedGitFileMap = ImmutableDictionary.Empty, ActiveGitTasks = ImmutableList.Empty, }; } diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs index de1752835..e2fa8c81c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs @@ -21,7 +21,7 @@ public partial class TreeViewGitFileDisplay : ComponentBase, ITreeViewGitFileRen private bool IsChecked { - get => GitState.SelectedGitFileMap.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); + get => GitState.StagedGitFileMap.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); set { var localGitState = GitState; @@ -35,16 +35,16 @@ private bool IsChecked } var key = TreeViewGitFile.Item.AbsolutePath.Value; - ImmutableDictionary outSelectedGitFileMap; + ImmutableDictionary outStagedGitFileMap; - if (inState.SelectedGitFileMap.ContainsKey(key)) - outSelectedGitFileMap = inState.SelectedGitFileMap.Remove(key); + if (inState.StagedGitFileMap.ContainsKey(key)) + outStagedGitFileMap = inState.StagedGitFileMap.Remove(key); else - outSelectedGitFileMap = inState.SelectedGitFileMap.Add(key, TreeViewGitFile.Item); + outStagedGitFileMap = inState.StagedGitFileMap.Add(key, TreeViewGitFile.Item); return inState with { - SelectedGitFileMap = outSelectedGitFileMap + StagedGitFileMap = outStagedGitFileMap }; })); } From 2f9fa8eba43dc4a27d60783173a7d40c7b5fcb85 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 19:17:36 -0400 Subject: [PATCH 37/56] Add: MoveCursorToEnd() to Terminal.cs --- .../Ide.RazorLib/Terminals/Models/Terminal.cs | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index d95ed937a..f55cfe23d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -92,6 +92,8 @@ public Task EnqueueCommandAsync(TerminalCommand terminalCommand) "Enqueue Command", async () => { + MoveCursorToEnd(); + if (terminalCommand.ChangeWorkingDirectoryTo is not null) WorkingDirectoryAbsolutePathString = terminalCommand.ChangeWorkingDirectoryTo; @@ -171,10 +173,10 @@ await command.Observe(_commandCancellationTokenSource.Token) switch (cmdEvent) { case StartedCommandEvent started: - output = $"> {terminalCommand.FormattedCommand.Value}\n" + - $"> PID:{started.ProcessId} PWD:{WorkingDirectoryAbsolutePathString}\n"; + output = $"{terminalCommand.FormattedCommand.Value}\n"; // + + // $"> PID:{started.ProcessId} PWD:{WorkingDirectoryAbsolutePathString}\n"; - output = null; + // output = null; break; case StandardOutputCommandEvent stdOut: output = $"{stdOut.Text}\n"; @@ -237,6 +239,7 @@ await command.Observe(_commandCancellationTokenSource.Token) finally { HasExecutingProcess = false; + WriteWorkingDirectory(); DispatchNewStateKey(); if (terminalCommand.ContinueWith is not null) @@ -491,6 +494,34 @@ await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( .ConfigureAwait(false); }); } + + public void MoveCursorToEnd() + { + _textEditorService.PostIndependent( + nameof(_textEditorService.ViewModelApi.MoveCursorFactory), + async editContext => + { + var modelModifier = editContext.GetModelModifier(ResourceUri); + var viewModelModifier = editContext.GetViewModelModifier(TextEditorViewModelKey); + var cursorModifierBag = editContext.GetCursorModifierBag(viewModelModifier?.ViewModel); + var primaryCursorModifier = editContext.GetPrimaryCursorModifier(cursorModifierBag); + + if (modelModifier is null || viewModelModifier is null || cursorModifierBag is null || primaryCursorModifier is null) + return; + + await _textEditorService.ViewModelApi.MoveCursorFactory( + new KeyboardEventArgs + { + Code = KeyboardKeyFacts.MovementKeys.END, + Key = KeyboardKeyFacts.MovementKeys.END, + CtrlKey = true, + }, + ResourceUri, + TextEditorViewModelKey) + .Invoke(editContext) + .ConfigureAwait(false); + }); + } public void AddOutput(string output, TerminalCommand terminalCommand, TerminalCommandBoundary terminalCommandBoundary) { From 3be480668c04229914e3aeb0ecc479800d719488 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 19:27:24 -0400 Subject: [PATCH 38/56] Fix: double working directory writeouts --- .../Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs b/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs index ec4ca20d9..cdd54e789 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs @@ -164,12 +164,7 @@ public bool TryMap( var terminalCommand = new TerminalCommand( Key.NewKey(), - formattedCommand, - ContinueWith: () => - { - terminalResource.Terminal.WriteWorkingDirectory(); - return Task.CompletedTask; - }); + formattedCommand); terminalResource.ManualDecorationTextSpanList.Add(terminalResource.TargetFilePathTextSpan); From 6f4fe5d37d335f98c7156ce9970fcb2bef7f5979 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Thu, 2 May 2024 19:39:29 -0400 Subject: [PATCH 39/56] Fix windows backslash in git cli --- .../Gits/Displays/GitControlsDisplay.razor.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index 435d04f15..d98297eb7 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -74,6 +74,18 @@ private async Task SubmitOnClick(GitState localGitState) fileAbsolutePath.AbsolutePath, EnvironmentProvider); + if (EnvironmentProvider.DirectorySeparatorChar == '\\') + { + // The following fails: + // git add ".\MyApp\" + // + // Whereas the following succeeds + // git add "./MyApp/" + relativePathString = relativePathString.Replace( + EnvironmentProvider.DirectorySeparatorChar, + EnvironmentProvider.AltDirectorySeparatorChar); + } + filesBuilder.Append($"\"{relativePathString}\" "); } From 949572efd0b03126c4d1ec2e037a7f8bb8d3f897 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 13:36:12 -0400 Subject: [PATCH 40/56] Add: HACK_PersonalSettings() --- Source/Lib/Ide/Host.Photino/Program.cs | 13 +- .../Displays/InputFileDisplay.razor.cs | 3 + .../Shareds/Displays/IdeMainLayout.razor.cs | 159 ++++++++++++++---- 3 files changed, 134 insertions(+), 41 deletions(-) diff --git a/Source/Lib/Ide/Host.Photino/Program.cs b/Source/Lib/Ide/Host.Photino/Program.cs index 383220b72..62ee33196 100644 --- a/Source/Lib/Ide/Host.Photino/Program.cs +++ b/Source/Lib/Ide/Host.Photino/Program.cs @@ -46,11 +46,14 @@ static void Main(string[] args) .SetLeft(50) .SetTop(50); - var specialFolderUserProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - if (specialFolderUserProfile == "C:\\Users\\hunte") - app.MainWindow.SetLeft(1_355); - else if (specialFolderUserProfile == "/home/hunter") - app.MainWindow.SetLeft(1_100).SetTop(100).SetHeight(1900); + // Personal settings to have closing and reopening the IDE be exactly where I want while developing. + { + var specialFolderUserProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + if (specialFolderUserProfile == "C:\\Users\\hunte") + app.MainWindow.SetLeft(1_355); + else if (specialFolderUserProfile == "/home/hunter") + app.MainWindow.SetLeft(1_100).SetTop(100).SetHeight(1900); + } var continuousStartCts = new CancellationTokenSource(); var blockingStartCts = new CancellationTokenSource(); diff --git a/Source/Lib/Ide/Ide.RazorLib/InputFiles/Displays/InputFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/InputFiles/Displays/InputFileDisplay.razor.cs index 7d64d9de5..338c300e9 100644 --- a/Source/Lib/Ide/Ide.RazorLib/InputFiles/Displays/InputFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/InputFiles/Displays/InputFileDisplay.razor.cs @@ -169,6 +169,9 @@ private void InitializeElementDimensions() }); } + /// + /// TODO: This code should be moved to an Effect, of which is throttled. (2024-05-03) + /// private async Task SetInputFileContentTreeViewRootFunc(IAbsolutePath absolutePath) { var pseudoRootNode = new TreeViewAbsolutePath( diff --git a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs index dd97d2bfd..bafeb09d1 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/IdeMainLayout.razor.cs @@ -1,4 +1,5 @@ using Fluxor; +using Luthetus.Common.RazorLib.ComponentRenderers.Models; using Luthetus.Common.RazorLib.Dimensions.Models; using Luthetus.Common.RazorLib.Drags.Displays; using Luthetus.Common.RazorLib.FileSystems.Models; @@ -7,10 +8,16 @@ using Luthetus.Common.RazorLib.Panels.States; using Luthetus.Common.RazorLib.Resizes.Displays; using Luthetus.Common.RazorLib.StateHasChangedBoundaries.Displays; +using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Ide.RazorLib.DotNetSolutions.States; +using Luthetus.Ide.RazorLib.InputFiles.Displays; +using Luthetus.Ide.RazorLib.InputFiles.States; using Luthetus.Ide.RazorLib.ProgramExecutions.States; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.TextEditor.RazorLib; using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; using System.Runtime.InteropServices; namespace Luthetus.Ide.RazorLib.Shareds.Displays; @@ -35,6 +42,12 @@ public partial class IdeMainLayout : LayoutComponentBase, IDisposable private IFileSystemProvider FileSystemProvider { get; set; } = null!; [Inject] private DotNetSolutionSync DotNetSolutionSync { get; set; } = null!; + [Inject] + private ILuthetusIdeComponentRenderers IdeComponentRenderers { get; set; } = null!; + [Inject] + private ILuthetusCommonComponentRenderers CommonComponentRenderers { get; set; } = null!; + [Inject] + private ITreeViewService TreeViewService { get; set; } = null!; private bool _previousDragStateWrapShouldDisplay; private ElementDimensions _bodyElementDimensions = new(); @@ -82,42 +95,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) await TextEditorService.OptionsApi.SetFromLocalStorageAsync(); await AppOptionsService.SetFromLocalStorageAsync(); - string personalTestPath; - -#if DEBUG - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - personalTestPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.sln"; - else - personalTestPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.sln"; -#else - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - personalTestPath = "/home/hunter/Repos/Luthetus.Ide_Fork/Luthetus.Ide.sln"; - else - personalTestPath = "C:\\Users\\hunte\\Repos\\Luthetus.Ide_Fork\\Luthetus.Ide.sln"; -#endif - - if (await FileSystemProvider.File.ExistsAsync(personalTestPath)) - { - var absolutePath = EnvironmentProvider.AbsolutePathFactory( - personalTestPath, - false); - - DotNetSolutionSync.SetDotNetSolution(absolutePath); - -#if DEBUG - string personalProjectPath; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - personalProjectPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.ServerSide/BlazorCrudApp.ServerSide.csproj"; - else - personalProjectPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.csproj"; - - Dispatcher.Dispatch(new ProgramExecutionState.SetStartupProjectAbsolutePathAction( - EnvironmentProvider.AbsolutePathFactory( - personalProjectPath, - false))); -#endif - } + await HACK_PersonalSettings(); } await base.OnAfterRenderAsync(firstRender); @@ -142,6 +120,115 @@ private async void TextEditorOptionsStateWrap_StateChanged(object? sender, Event await InvokeAsync(StateHasChanged); } + /// + /// Personal settings to have closing and reopening the IDE be exactly the state I want while developing. + /// + private async Task HACK_PersonalSettings() + { + string? slnPersonalPath = null; + string? projectPersonalPath = null; +#if DEBUG + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + slnPersonalPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.sln"; + projectPersonalPath = "/home/hunter/Repos/BlazorCrudApp/BlazorCrudApp.ServerSide/BlazorCrudApp.ServerSide.csproj"; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + slnPersonalPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.sln"; + projectPersonalPath = "C:\\Users\\hunte\\Repos\\Demos\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg\\BlazorApp4NetCoreDbg.csproj"; + } +#else + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + slnPersonalPath = "/home/hunter/Repos/Luthetus.Ide_Fork/Luthetus.Ide.sln"; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + slnPersonalPath = "C:\\Users\\hunte\\Repos\\Luthetus.Ide_Fork\\Luthetus.Ide.sln"; + } +#endif + if (!string.IsNullOrWhiteSpace(slnPersonalPath) && + await FileSystemProvider.File.ExistsAsync(slnPersonalPath)) + { + var slnAbsolutePath = EnvironmentProvider.AbsolutePathFactory( + slnPersonalPath, + false); + + DotNetSolutionSync.SetDotNetSolution(slnAbsolutePath); + + var parentDirectory = slnAbsolutePath.ParentDirectory; + if (parentDirectory is not null) + { + var parentDirectoryAbsolutePath = EnvironmentProvider.AbsolutePathFactory( + parentDirectory.Value, + true); + + var pseudoRootNode = new TreeViewAbsolutePath( + parentDirectoryAbsolutePath, + IdeComponentRenderers, + CommonComponentRenderers, + FileSystemProvider, + EnvironmentProvider, + true, + false); + + await pseudoRootNode.LoadChildListAsync(); + + var adhocRootNode = TreeViewAdhoc.ConstructTreeViewAdhoc(pseudoRootNode.ChildList.ToArray()); + + foreach (var child in adhocRootNode.ChildList) + { + child.IsExpandable = false; + } + + var activeNode = adhocRootNode.ChildList.FirstOrDefault(); + + if (!TreeViewService.TryGetTreeViewContainer(InputFileContent.TreeViewContainerKey, out var treeViewContainer)) + { + TreeViewService.RegisterTreeViewContainer(new TreeViewContainer( + InputFileContent.TreeViewContainerKey, + adhocRootNode, + activeNode is null + ? ImmutableList.Empty + : new TreeViewNoType[] { activeNode }.ToImmutableList())); + } + else + { + TreeViewService.SetRoot(InputFileContent.TreeViewContainerKey, adhocRootNode); + + TreeViewService.SetActiveNode( + InputFileContent.TreeViewContainerKey, + activeNode, + true, + false); + } + + await pseudoRootNode.LoadChildListAsync(); + + var setOpenedTreeViewModelAction = new InputFileState.SetOpenedTreeViewModelAction( + pseudoRootNode, + IdeComponentRenderers, + CommonComponentRenderers, + FileSystemProvider, + EnvironmentProvider); + + Dispatcher.Dispatch(setOpenedTreeViewModelAction); + } + + if (!string.IsNullOrWhiteSpace(projectPersonalPath) && + await FileSystemProvider.File.ExistsAsync(projectPersonalPath)) + { + var projectAbsolutePath = EnvironmentProvider.AbsolutePathFactory( + projectPersonalPath, + false); + + Dispatcher.Dispatch(new ProgramExecutionState.SetStartupProjectAbsolutePathAction( + projectAbsolutePath)); + } + } + } + public void Dispose() { DragStateWrap.StateChanged -= DragStateWrapOnStateChanged; From ae07f9967df4b37f46f9059d411240833956c6a3 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 13:45:19 -0400 Subject: [PATCH 41/56] Use "git status -u" so directories are expanded into their files --- .../Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index d98297eb7..2fa4479b5 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -35,9 +35,13 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + var gitStatusDashUCommand = $"{GitCliFacts.STATUS_COMMAND} -u"; var formattedCommand = new FormattedCommand( GitCliFacts.TARGET_FILE_NAME, - new string[] { GitCliFacts.STATUS_COMMAND }); + new string[] { gitStatusDashUCommand }) + { + HACK_ArgumentsString = gitStatusDashUCommand + }; var gitCliOutputParser = new GitCliOutputParser( Dispatcher, From 99de8cb59c4ca6f2d017caf99d7c398506b4f6f3 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 14:30:23 -0400 Subject: [PATCH 42/56] Parse CLI in a blocking manner --- .../Displays/GitChangesTreeViewDisplay.razor | 2 +- .../Gits/Displays/GitControlsDisplay.razor.cs | 7 +- .../Ide/Ide.RazorLib/Gits/Models/GitFile.cs | 2 +- .../Gits/States/GitSync.Constructor.cs | 34 -- .../Gits/States/GitSync.Enqueues.cs | 31 -- .../Ide.RazorLib/Gits/States/GitSync.Tasks.cs | 333 ------------------ .../Displays/StartupControlsDisplay.razor.cs | 2 +- .../Terminals/Models/DotNetRunOutputParser.cs | 9 +- .../Terminals/Models/GitCliOutputParser.cs | 40 ++- .../Terminals/Models/IOutputParser.cs | 21 ++ .../Ide.RazorLib/Terminals/Models/Terminal.cs | 22 +- .../Terminals/Models/TerminalCommand.cs | 3 +- .../Models/TreeViewGitFileTests.cs | 5 +- 13 files changed, 82 insertions(+), 429 deletions(-) delete mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Constructor.cs delete mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Enqueues.cs delete mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs create mode 100644 Source/Lib/Ide/Ide.RazorLib/Terminals/Models/IOutputParser.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor index a28276250..96c06942e 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor @@ -5,7 +5,7 @@ @using Luthetus.Ide.RazorLib.Terminals.Models @using System.Collections.Immutable -
@{ var appOptionsState = AppOptionsStateWrap.Value; } diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index 2fa4479b5..0e46caf96 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -6,6 +6,7 @@ using Luthetus.Ide.RazorLib.Terminals.Models; using Luthetus.Ide.RazorLib.Terminals.States; using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; using System.Text; namespace Luthetus.Ide.RazorLib.Gits.Displays; @@ -53,7 +54,11 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() NewDotNetSolutionTerminalCommandKey, formattedCommand, parentDirectory.Value, - ParseFunc: gitCliOutputParser.Parse); + ContinueWith: () => + { + return Task.CompletedTask; + }, + OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitStatusCommand); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs index 32c6b7a25..67943b178 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitFile.cs @@ -3,7 +3,7 @@ namespace Luthetus.Ide.RazorLib.Gits.Models; -public record GitFile(IAbsolutePath AbsolutePath, GitDirtyReason GitDirtyReason) +public record GitFile(IAbsolutePath AbsolutePath, string RelativePathString, GitDirtyReason GitDirtyReason) { public bool IsDirty => GitDirtyReason switch { diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Constructor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Constructor.cs deleted file mode 100644 index e5a5cab5a..000000000 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Constructor.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Fluxor; -using Luthetus.Common.RazorLib.BackgroundTasks.Models; -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Ide.RazorLib.Terminals.States; - -namespace Luthetus.Ide.RazorLib.Gits.States; - -public partial class GitSync -{ - private readonly IState _terminalStateWrap; - private readonly IState _gitStateWrap; - private readonly IFileSystemProvider _fileSystemProvider; - private readonly IEnvironmentProvider _environmentProvider; - - public GitSync( - IState terminalStateWrap, - IState gitStateWrap, - IFileSystemProvider fileSystemProvider, - IEnvironmentProvider environmentProvider, - IBackgroundTaskService backgroundTaskService, - IDispatcher dispatcher) - { - _terminalStateWrap = terminalStateWrap; - _gitStateWrap = gitStateWrap; - _fileSystemProvider = fileSystemProvider; - _environmentProvider = environmentProvider; - - BackgroundTaskService = backgroundTaskService; - Dispatcher = dispatcher; - } - - public IBackgroundTaskService BackgroundTaskService { get; } - public IDispatcher Dispatcher { get; } -} diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Enqueues.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Enqueues.cs deleted file mode 100644 index 03a15834d..000000000 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Enqueues.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Common.RazorLib.BackgroundTasks.Models; -using Luthetus.Common.RazorLib.Keys.Models; - -namespace Luthetus.Ide.RazorLib.Gits.States; - -public partial class GitSync -{ - public void RefreshGit(CancellationToken cancellationToken) - { - BackgroundTaskService.Enqueue(Key.NewKey(), ContinuousBackgroundTaskWorker.GetQueueKey(), - "Git Refresh", - async () => await RefreshGitAsync(cancellationToken)); - } - - public void GitInit(CancellationToken cancellationToken) - { - BackgroundTaskService.Enqueue(Key.NewKey(), ContinuousBackgroundTaskWorker.GetQueueKey(), - "Git Init", - async () => await GitInitAsync(cancellationToken)); - } - - public void TryFindGitFolderInDirectory( - IAbsolutePath directoryAbsolutePath, - CancellationToken cancellationToken) - { - BackgroundTaskService.Enqueue(Key.NewKey(), ContinuousBackgroundTaskWorker.GetQueueKey(), - "Git Find '.git' Folder", - async () => await TryFindGitFolderInDirectoryAsync(directoryAbsolutePath, cancellationToken)); - } -} diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs deleted file mode 100644 index 7e4e9b6d1..000000000 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitSync.Tasks.cs +++ /dev/null @@ -1,333 +0,0 @@ -using System.Text; -using System.Collections.Immutable; -using Luthetus.Ide.RazorLib.Gits.Models; -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Ide.RazorLib.CommandLines.Models; -using Luthetus.Ide.RazorLib.Terminals.Models; -using static Luthetus.Ide.RazorLib.Gits.States.GitState; - -namespace Luthetus.Ide.RazorLib.Gits.States; - -public partial class GitSync -{ - private async Task RefreshGitAsync(CancellationToken cancellationToken) - { - var handleRefreshGitTask = new GitTask( - Guid.NewGuid(), - nameof(RefreshGit), - cancellationToken); - - if (cancellationToken.IsCancellationRequested) - return; - - var gitState = _gitStateWrap.Value; - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Add(handleRefreshGitTask); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - - // Do not combine this following Dispatch for GitFilesList replacement - // with the Dispatch for ActiveGitTasks replacement. - // It could cause confusion in the future when one gets removed - // without realizing the other was also part of the Dispatch replacement. - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => inGitState with - { - GitFileList = ImmutableList.Empty - })); - - if (gitState.GitFolderAbsolutePath is null || - !await _fileSystemProvider.Directory.ExistsAsync(gitState.GitFolderAbsolutePath.Value) || - gitState.GitFolderAbsolutePath.ParentDirectory is null) - { - return; - } - - var generalTerminal = _terminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; - - var formattedCommand = new FormattedCommand(GitCliFacts.TARGET_FILE_NAME, new[] - { - GitCliFacts.STATUS_COMMAND - }); - - var gitStatusCommand = new TerminalCommand( - GitFacts.GitStatusTerminalCommandKey, - formattedCommand, - gitState.GitFolderAbsolutePath.ParentDirectory.Value, - CancellationToken.None, - async () => - { - var success = generalTerminal.TryGetTerminalCommandTextSpan( - GitFacts.GitStatusTerminalCommandKey, - out var terminalCommandTextSpan); - - var gitStatusOutput = terminalCommandTextSpan.GetText(); - if (gitStatusOutput is null) - return; - - await GetGitOutputSectionAsync( - gitState, - gitStatusOutput, - GitFacts.UNTRACKED_FILES_TEXT_START, - GitDirtyReason.Untracked, - UntrackedFilesOnAfterCompletedAction); - - await GetGitOutputSectionAsync( - gitState, - gitStatusOutput, - GitFacts.CHANGES_NOT_STAGED_FOR_COMMIT_TEXT_START, - null, - ChangesNotStagedOnAfterCompletedAction); - }); - - await generalTerminal.EnqueueCommandAsync(gitStatusCommand); - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Remove(handleRefreshGitTask); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - - void UntrackedFilesOnAfterCompletedAction(ImmutableList gitFiles) - { - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextGitFilesList = inGitState.GitFileList.AddRange(gitFiles); - return inGitState with { GitFileList = nextGitFilesList }; - })); - } - - void ChangesNotStagedOnAfterCompletedAction(ImmutableList gitFiles) - { - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextGitFilesList = inGitState.GitFileList.AddRange(gitFiles); - return inGitState with { GitFileList = nextGitFilesList }; - })); - } - } - - private async Task GitInitAsync(CancellationToken cancellationToken) - { - var handleHandleGitInitAction = new GitTask( - Guid.NewGuid(), - nameof(RefreshGit), - cancellationToken); - - if (cancellationToken.IsCancellationRequested) - return; - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Add(handleHandleGitInitAction); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - - var gitState = _gitStateWrap.Value; - - if (gitState.GitFolderAbsolutePath is null) - return; - - var formattedCommand = new FormattedCommand(GitCliFacts.TARGET_FILE_NAME, new[] - { - GitCliFacts.INIT_COMMAND - }); - - var gitInitCommand = new TerminalCommand( - GitFacts.GitInitTerminalCommandKey, - formattedCommand, - gitState.GitFolderAbsolutePath.Value, - CancellationToken.None, - async () => await RefreshGitAsync(cancellationToken)); - - var generalTerminal = _terminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; - await generalTerminal.EnqueueCommandAsync(gitInitCommand); - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Remove(handleHandleGitInitAction); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - } - - private async Task TryFindGitFolderInDirectoryAsync( - IAbsolutePath directoryAbsolutePath, - CancellationToken cancellationToken) - { - var handleTryFindGitFolderInDirectoryAction = new GitTask( - Guid.NewGuid(), - nameof(RefreshGit), - cancellationToken); - - if (cancellationToken.IsCancellationRequested) - return; - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Add(handleTryFindGitFolderInDirectoryAction); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - - if (!directoryAbsolutePath.IsDirectory) - return; - - var directoryAbsolutePathString = directoryAbsolutePath.Value; - - var childDirectoryAbsolutePathStrings = await _fileSystemProvider.Directory.GetDirectoriesAsync( - directoryAbsolutePathString); - - var gitFolderAbsolutePathString = childDirectoryAbsolutePathStrings.FirstOrDefault( - x => x.EndsWith(GitFacts.GIT_FOLDER_NAME)); - - if (gitFolderAbsolutePathString is not null) - { - var gitFolderAbsolutePath = _environmentProvider.AbsolutePathFactory( - gitFolderAbsolutePathString, - true); - - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => inGitState with - { - GitFolderAbsolutePath = gitFolderAbsolutePath - })); - - await RefreshGitAsync(cancellationToken); - } - else - { - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => inGitState with - { - GitFolderAbsolutePath = null, - })); - } - Dispatcher.Dispatch(new SetGitStateWithAction(inGitState => - { - var nextActiveGitTasks = inGitState.ActiveGitTasks.Remove(handleTryFindGitFolderInDirectoryAction); - return inGitState with { ActiveGitTasks = nextActiveGitTasks }; - })); - } - - private async Task GetGitOutputSectionAsync( - GitState gitState, - string gitStatusOutput, - string sectionStart, - GitDirtyReason? gitDirtyReason, - Action> onAfterCompletedAction) - { - if (gitState.GitFolderAbsolutePath?.ParentDirectory is null) - return; - - var indexOfChangesNotStagedForCommitTextStart = gitStatusOutput.IndexOf( - sectionStart, - StringComparison.InvariantCulture); - - if (indexOfChangesNotStagedForCommitTextStart != -1) - { - var startOfChangesNotStagedForCommitIndex = indexOfChangesNotStagedForCommitTextStart + - sectionStart.Length; - - var gitStatusOutputReader = new StringReader( - gitStatusOutput.Substring(startOfChangesNotStagedForCommitIndex)); - - var changesNotStagedForCommitBuilder = new StringBuilder(); - - // This skips the second newline when seeing: "\n\n" - string? currentLine = await gitStatusOutputReader.ReadLineAsync(); - - while ((currentLine = await gitStatusOutputReader.ReadLineAsync()) is not null && - currentLine.Length > 0) - { - // It is presumed that git CLI provides comments on lines - // which start with two space characters. - // - // Whereas output for this command starts with a tab. - // - // TODO: I imagine this is a very naive presumption and this should be revisited but I am still feeling out how to write this git logic. - - /* - * Changes not staged for commit: - * (use "git add/rm ..." to update what will be committed) - * (use "git restore ..." to discard changes in working directory) - * modified: BlazorCrudApp.ServerSide/Pages/Counter.razor - * deleted: BlazorCrudApp.ServerSide/Shared/SurveyPrompt.razor - */ - if (currentLine.StartsWith(new string(' ', 2))) - continue; - - changesNotStagedForCommitBuilder.Append(currentLine); - } - - var changesNotStagedForCommitText = changesNotStagedForCommitBuilder.ToString(); - - var changesNotStagedForCommitCollection = changesNotStagedForCommitText - .Split('\t') - .Select(x => x.Trim()) - .OrderBy(x => x) - .ToArray(); - - if (changesNotStagedForCommitCollection.First() == string.Empty) - { - changesNotStagedForCommitCollection = changesNotStagedForCommitCollection - .Skip(1) - .ToArray(); - } - - (string relativePath, GitDirtyReason gitDirtyReason)[] changesNotStagedForCommitRelativePathAndGitDirtyReasonTuples; - - if (gitDirtyReason is not null) - { - changesNotStagedForCommitRelativePathAndGitDirtyReasonTuples = changesNotStagedForCommitCollection - .Select(x => (x, gitDirtyReason.Value)) - .ToArray(); - } - else - { - changesNotStagedForCommitRelativePathAndGitDirtyReasonTuples = changesNotStagedForCommitCollection - .Select(x => - { - var relativePath = x; - GitDirtyReason innerGitDirtyReason = GitDirtyReason.None; - - if (x.StartsWith(GitFacts.GIT_DIRTY_REASON_MODIFIED)) - { - innerGitDirtyReason = GitDirtyReason.Modified; - - relativePath = new string(relativePath - .Skip(GitFacts.GIT_DIRTY_REASON_MODIFIED.Length) - .ToArray()); - } - else if (x.StartsWith(GitFacts.GIT_DIRTY_REASON_DELETED)) - { - innerGitDirtyReason = GitDirtyReason.Deleted; - - relativePath = new string(relativePath - .Skip(GitFacts.GIT_DIRTY_REASON_DELETED.Length) - .ToArray()); - } - - return (relativePath, innerGitDirtyReason); - }) - .ToArray(); - } - - var changesNotStagedForCommitGitFiles = changesNotStagedForCommitRelativePathAndGitDirtyReasonTuples - .Select(x => - { - var absolutePathString = - gitState.GitFolderAbsolutePath.ParentDirectory + - x.relativePath; - - var isDirectory = _environmentProvider.IsDirectorySeparator(x.relativePath.LastOrDefault()); - - var absolutePath = _environmentProvider.AbsolutePathFactory( - absolutePathString, - isDirectory); - - return new GitFile(absolutePath, x.gitDirtyReason); - }) - .ToImmutableList(); - - onAfterCompletedAction.Invoke(changesNotStagedForCommitGitFiles); - } - } -} diff --git a/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs index 6496598ec..90376bed4 100644 --- a/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/StartupControls/Displays/StartupControlsDisplay.razor.cs @@ -41,7 +41,7 @@ public partial class StartupControlsDisplay : FluxorComponent formattedCommand, ancestorDirectory.Value, _newDotNetSolutionCancellationTokenSource.Token, - ParseFunc: DotNetRunOutputParser.Parse); + OutputParser: new DotNetRunOutputParser()); } private async Task StartProgramWithoutDebuggingOnClick() diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/DotNetRunOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/DotNetRunOutputParser.cs index c59311c63..63edcd2d6 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/DotNetRunOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/DotNetRunOutputParser.cs @@ -4,9 +4,9 @@ namespace Luthetus.Ide.RazorLib.Terminals.Models; -public static class DotNetRunOutputParser +public class DotNetRunOutputParser : IOutputParser { - public static List Parse(string output) + public List ParseLine(string output) { var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/DotNetRunOutputParser.txt"), output); @@ -186,4 +186,9 @@ public static List Parse(string output) return textSpanList; } + + public void Dispose() + { + return; + } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index f66598366..972916419 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -9,14 +9,13 @@ namespace Luthetus.Ide.RazorLib.Terminals.Models; -public class GitCliOutputParser +public class GitCliOutputParser : IOutputParser { private readonly IDispatcher _dispatcher; private readonly GitState _gitState; - private readonly IAbsolutePath _workingDirectory; + private readonly IAbsolutePath _workingDirectoryAbsolutePath; private readonly IEnvironmentProvider _environmentProvider; - private readonly List _gitFileList = new(); - + public GitCliOutputParser( IDispatcher dispatcher, GitState gitState, @@ -25,13 +24,15 @@ public GitCliOutputParser( { _dispatcher = dispatcher; _gitState = gitState; - _workingDirectory = workingDirectory; + _workingDirectoryAbsolutePath = workingDirectory; _environmentProvider = environmentProvider; } private StageKind _stageKind = StageKind.None; - public List Parse(string output) + public List GitFileList { get; } = new(); + + public List ParseLine(string output) { if (_gitState.GitFolderAbsolutePath is null) return new(); @@ -119,19 +120,22 @@ public List Parse(string output) (byte)TerminalDecorationKind.Warning); textSpanList.Add(textSpan); - var text = textSpan.GetText(); + var relativePathString = textSpan.GetText(); var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( - _workingDirectory, - text, + _workingDirectoryAbsolutePath, + relativePathString, _environmentProvider); - var isDirectory = text.EndsWith(_environmentProvider.DirectorySeparatorChar) || - text.EndsWith(_environmentProvider.AltDirectorySeparatorChar); + var isDirectory = relativePathString.EndsWith(_environmentProvider.DirectorySeparatorChar) || + relativePathString.EndsWith(_environmentProvider.AltDirectorySeparatorChar); var absolutePath = _environmentProvider.AbsolutePathFactory(absolutePathString, isDirectory); - _gitFileList.Add(new GitFile(absolutePath, GitDirtyReason.Untracked)); + GitFileList.Add(new GitFile( + absolutePath, + relativePathString, + GitDirtyReason.Untracked)); } break; @@ -144,11 +148,17 @@ public List Parse(string output) _ = stringWalker.ReadCharacter(); } + return textSpanList; + } + + public void Dispose() + { + if (_gitState.GitFolderAbsolutePath is null) + return; + _dispatcher.Dispatch(new GitState.SetGitFileListAction( _gitState.GitFolderAbsolutePath, - _gitFileList.ToImmutableList())); - - return textSpanList; + GitFileList.ToImmutableList())); } private enum StageKind diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/IOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/IOutputParser.cs new file mode 100644 index 000000000..d5b086673 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/IOutputParser.cs @@ -0,0 +1,21 @@ +using Luthetus.TextEditor.RazorLib.Lexes.Models; + +namespace Luthetus.Ide.RazorLib.Terminals.Models; + +/// +/// This type defines a method that can be invoked each time output is written to the terminal. +/// Furthermore, is invoked when the terminal command finished +/// execution, and blocks any further terminal commands from executing until the +/// is finished.

+///
+public interface IOutputParser : IDisposable +{ + /// + /// This method is invoked foreach line of output, while the CLI is executing. + /// For batching logic, one can have the implementation handle that, + /// for example by tracking all the parsed lines, until the invocation of . + /// At this point, one could then as a batch operation apply the syntax highlighting to all lines of the + /// commands output. + /// + public List ParseLine(string output); +} diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index f55cfe23d..1d2f47656 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -190,7 +190,14 @@ await command.Observe(_commandCancellationTokenSource.Token) } if (output is not null) - AddOutput(output, terminalCommand, terminalCommandBoundary); + { + var outputTextSpanList = new List(); + + if (terminalCommand.OutputParser is not null) + outputTextSpanList = terminalCommand.OutputParser.ParseLine(output); + + AddOutput(output, terminalCommand, terminalCommandBoundary, outputTextSpanList); + } DispatchNewStateKey(); }); @@ -244,6 +251,8 @@ await command.Observe(_commandCancellationTokenSource.Token) if (terminalCommand.ContinueWith is not null) await terminalCommand.ContinueWith.Invoke(); + + terminalCommand.OutputParser?.Dispose(); } }); @@ -523,7 +532,11 @@ await _textEditorService.ViewModelApi.MoveCursorFactory( }); } - public void AddOutput(string output, TerminalCommand terminalCommand, TerminalCommandBoundary terminalCommandBoundary) + public void AddOutput( + string output, + TerminalCommand terminalCommand, + TerminalCommandBoundary terminalCommandBoundary, + List outputTextSpanList) { _textEditorService.PostIndependent( nameof(EnqueueCommandAsync), @@ -540,11 +553,6 @@ public void AddOutput(string output, TerminalCommand terminalCommand, TerminalCo var entryPositionIndex = modelModifier.GetPositionIndex(primaryCursorModifier); terminalCommandBoundary.StartPositionIndexInclusive ??= entryPositionIndex; - var outputTextSpanList = new List(); - - if (terminalCommand.ParseFunc is not null) - outputTextSpanList = terminalCommand.ParseFunc.Invoke(output); - await _textEditorService.ModelApi.InsertTextFactory( ResourceUri, TextEditorViewModelKey, diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs index f9439ad34..3064e2158 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/TerminalCommand.cs @@ -1,6 +1,5 @@ using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Ide.RazorLib.CommandLines.Models; -using Luthetus.TextEditor.RazorLib.Lexes.Models; namespace Luthetus.Ide.RazorLib.Terminals.Models; @@ -11,4 +10,4 @@ public record TerminalCommand( CancellationToken CancellationToken = default, Func? ContinueWith = null, Func? BeginWith = null, - Func>? ParseFunc = null); + IOutputParser? OutputParser = null); diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs index a0a20041f..8024403b6 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs @@ -30,8 +30,11 @@ public void Constructor() var fileSystemProvider = serviceProvider.GetRequiredService(); var environmentProvider = serviceProvider.GetRequiredService(); + var path = "/unitTesting.txt"; + var gitFile = new GitFile( - environmentProvider.AbsolutePathFactory("/unitTesting.txt", false), + environmentProvider.AbsolutePathFactory(path, false), + path, GitDirtyReason.Untracked); var isExpandable = true; From 3b8683e71b60fb4f94e7654a803ffcd4fc59a467 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 15:05:24 -0400 Subject: [PATCH 43/56] Add: OnOutput.cs --- .../Ide.RazorLib/Events/Models/OnOutput.cs | 133 ++++++++++++++++++ .../Events/Models/OnOutputBatch.cs | 74 ++++++++++ .../Terminals/TextEditorKeymapTerminal.cs | 2 +- .../Ide.RazorLib/Terminals/Models/Terminal.cs | 119 ++++++---------- .../TextEditor/Events/BatchScrollEvents.cs | 13 -- .../Events/{ => Models}/EventUtils.cs | 2 +- .../Events/{ => Models}/OnDoubleClick.cs | 2 +- .../Events/{ => Models}/OnKeyDown.cs | 4 +- .../Events/{ => Models}/OnKeyDownBatch.cs | 2 +- .../Events/{ => Models}/OnMouseDown.cs | 2 +- .../Events/{ => Models}/OnMouseMove.cs | 2 +- .../Events/{ => Models}/OnScrollHorizontal.cs | 2 +- .../Events/{ => Models}/OnScrollVertical.cs | 2 +- .../TextEditor/Events/{ => Models}/OnWheel.cs | 2 +- .../Events/{ => Models}/OnWheelBatch.cs | 2 +- .../Internals/ScrollbarHorizontal.razor.cs | 2 +- .../Internals/ScrollbarVertical.razor.cs | 2 +- .../TextEditorViewModelDisplay.razor.cs | 1 + 18 files changed, 263 insertions(+), 105 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs create mode 100644 Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs delete mode 100644 Source/Lib/TextEditor/Events/BatchScrollEvents.cs rename Source/Lib/TextEditor/Events/{ => Models}/EventUtils.cs (98%) rename Source/Lib/TextEditor/Events/{ => Models}/OnDoubleClick.cs (98%) rename Source/Lib/TextEditor/Events/{ => Models}/OnKeyDown.cs (99%) rename Source/Lib/TextEditor/Events/{ => Models}/OnKeyDownBatch.cs (99%) rename Source/Lib/TextEditor/Events/{ => Models}/OnMouseDown.cs (98%) rename Source/Lib/TextEditor/Events/{ => Models}/OnMouseMove.cs (98%) rename Source/Lib/TextEditor/Events/{ => Models}/OnScrollHorizontal.cs (97%) rename Source/Lib/TextEditor/Events/{ => Models}/OnScrollVertical.cs (97%) rename Source/Lib/TextEditor/Events/{ => Models}/OnWheel.cs (98%) rename Source/Lib/TextEditor/Events/{ => Models}/OnWheelBatch.cs (98%) diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs new file mode 100644 index 000000000..9d8d4187f --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs @@ -0,0 +1,133 @@ +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.TextEditor.RazorLib; +using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Symbols; +using Luthetus.TextEditor.RazorLib.Lexes.Models; +using Luthetus.TextEditor.RazorLib.TextEditors.Displays; +using Luthetus.TextEditor.RazorLib.TextEditors.Models; + +namespace Luthetus.Ide.RazorLib.Events.Models; + +/// +/// This class is what one would use. Then, if batching is applicable, +/// an instance of will be made in place +/// of the events which are being batched.

+/// +/// This class is for use with command line text output. +/// For example, every time a line of output is written to stdout +/// one could furthermore invoke this event to write to the text editor +/// in a batched manner. +///
+public class OnOutput : ITextEditorTask +{ + private readonly TerminalCommandBoundary _terminalCommandBoundary; + + public OnOutput( + string output, + List outputTextSpanList, + ResourceUri resourceUri, + ITextEditorService textEditorService, + TerminalCommandBoundary terminalCommandBoundary, + Key viewModelKey) + { + Output = output; + _outputTextSpanList = outputTextSpanList; + ResourceUri = resourceUri; + TextEditorService = textEditorService; + _terminalCommandBoundary = terminalCommandBoundary; + ViewModelKey = viewModelKey; + } + + private List _outputTextSpanList; + + public Key BackgroundTaskKey { get; } = Key.NewKey(); + public Key QueueKey { get; } = ContinuousBackgroundTaskWorker.GetQueueKey(); + public string Name { get; } = nameof(OnOutput); + public Task? WorkProgress { get; } + public string Output { get; } + public ResourceUri ResourceUri { get; } + public ITextEditorService TextEditorService { get; } + public Key ViewModelKey { get; } + + public TimeSpan ThrottleTimeSpan => TextEditorViewModelDisplay.TextEditorEvents.ThrottleDelayDefault; + + public async Task InvokeWithEditContext(IEditContext editContext) + { + var modelModifier = editContext.GetModelModifier(ResourceUri); + var viewModelModifier = editContext.GetViewModelModifier(ViewModelKey); + var cursorModifierBag = editContext.GetCursorModifierBag(viewModelModifier?.ViewModel); + var primaryCursorModifier = editContext.GetPrimaryCursorModifier(cursorModifierBag); + + if (modelModifier is null || viewModelModifier is null || cursorModifierBag is null || primaryCursorModifier is null) + return; + + var entryPositionIndex = modelModifier.GetPositionIndex(primaryCursorModifier); + _terminalCommandBoundary.StartPositionIndexInclusive ??= entryPositionIndex; + + await TextEditorService.ModelApi.InsertTextFactory( + ResourceUri, + ViewModelKey, + Output, + CancellationToken.None) + .Invoke(editContext) + .ConfigureAwait(false); + + var terminalCompilerService = (TerminalCompilerService)modelModifier.CompilerService; + if (terminalCompilerService.GetCompilerServiceResourceFor(modelModifier.ResourceUri) is not TerminalResource terminalResource) + return; + + _outputTextSpanList = _outputTextSpanList.Select(x => x with + { + StartingIndexInclusive = entryPositionIndex + x.StartingIndexInclusive, + EndingIndexExclusive = entryPositionIndex + x.EndingIndexExclusive, + ResourceUri = ResourceUri, + SourceText = modelModifier.GetAllText(), + }).ToList(); + + terminalResource.ManualDecorationTextSpanList.AddRange(_outputTextSpanList); + terminalResource.ManualSymbolList.AddRange(_outputTextSpanList.Select(x => new SourceFileSymbol(x))); + + await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( + modelModifier.ResourceUri, + terminalResource.GetTokenTextSpans()) + .Invoke(editContext) + .ConfigureAwait(false); + + _terminalCommandBoundary.EndPositionIndexExclusive = modelModifier.GetPositionIndex(primaryCursorModifier); + } + + public IBackgroundTask? BatchOrDefault(IBackgroundTask oldEvent) + { + if (oldEvent is OnOutput oldEventOnOutput) + { + var outputList = new List + { + oldEventOnOutput.Output, + Output + }; + + return new OnOutputBatch( + outputList, + _outputTextSpanList, + ResourceUri, + TextEditorService, + _terminalCommandBoundary, + ViewModelKey); + } + + if (oldEvent is OnOutputBatch oldEventOnWheelBatch) + { + oldEventOnWheelBatch.OutputList.Add(Output); + return oldEventOnWheelBatch; + } + + return null; + } + + public Task HandleEvent(CancellationToken cancellationToken) + { + throw new NotImplementedException($"{nameof(ITextEditorTask)} should not implement {nameof(HandleEvent)}" + + "because they instead are contained within an 'IBackgroundTask' that came from the 'TextEditorService'"); + } +} diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs new file mode 100644 index 000000000..5fe1bbcbb --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs @@ -0,0 +1,74 @@ +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.TextEditor.RazorLib.Lexes.Models; +using Luthetus.TextEditor.RazorLib; +using Luthetus.TextEditor.RazorLib.TextEditors.Displays; +using Luthetus.TextEditor.RazorLib.TextEditors.Models; + +namespace Luthetus.Ide.RazorLib.Events.Models; + +/// +/// This class is for use with command line text output. +/// For example, every time a line of output is written to stdout +/// one could furthermore invoke this event to write to the text editor +/// in a batched manner. +/// +public class OnOutputBatch : ITextEditorTask +{ + private readonly TerminalCommandBoundary _terminalCommandBoundary; + + public OnOutputBatch( + List outputList, + List outputTextSpanList, + ResourceUri resourceUri, + ITextEditorService textEditorService, + TerminalCommandBoundary terminalCommandBoundary, + Key viewModelKey) + { + OutputList = outputList; + _outputTextSpanList = outputTextSpanList; + ResourceUri = resourceUri; + TextEditorService = textEditorService; + _terminalCommandBoundary = terminalCommandBoundary; + ViewModelKey = viewModelKey; + } + + private List _outputTextSpanList; + + public Key BackgroundTaskKey { get; } = Key.NewKey(); + public Key QueueKey { get; } = ContinuousBackgroundTaskWorker.GetQueueKey(); + public string Name { get; } = nameof(OnOutput); + public Task? WorkProgress { get; } + public List OutputList { get; } + public ResourceUri ResourceUri { get; } + public ITextEditorService TextEditorService { get; } + public Key ViewModelKey { get; } + + public TimeSpan ThrottleTimeSpan => TextEditorViewModelDisplay.TextEditorEvents.ThrottleDelayDefault; + + public Task InvokeWithEditContext(IEditContext editContext) + { + var onOutput = new OnOutput( + string.Join(string.Empty, OutputList), + _outputTextSpanList, + ResourceUri, + TextEditorService, + _terminalCommandBoundary, + ViewModelKey); + + return onOutput.InvokeWithEditContext(editContext); + } + + public IBackgroundTask? BatchOrDefault(IBackgroundTask oldEvent) + { + return null; + } + + public Task HandleEvent(CancellationToken cancellationToken) + { + throw new NotImplementedException($"{nameof(ITextEditorTask)} should not implement {nameof(HandleEvent)}" + + "because they instead are contained within an 'IBackgroundTask' that came from the 'TextEditorService'"); + } +} + diff --git a/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs b/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs index cdd54e789..56eb3f62c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Keymaps/Models/Terminals/TextEditorKeymapTerminal.cs @@ -22,7 +22,7 @@ using Luthetus.Ide.RazorLib.Terminals.States; using Luthetus.TextEditor.RazorLib.Lexes.Models; using System.Collections.Immutable; -using Luthetus.TextEditor.RazorLib.Events; +using Luthetus.TextEditor.RazorLib.Events.Models; namespace Luthetus.Ide.RazorLib.Keymaps.Models.Terminals; diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index 1d2f47656..858d15c6f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -19,6 +19,7 @@ using System.Collections.Immutable; using System.Reactive.Linq; using Microsoft.AspNetCore.Components.Web; +using Luthetus.Ide.RazorLib.Events.Models; namespace Luthetus.Ide.RazorLib.Terminals.Models; @@ -140,25 +141,7 @@ public Task EnqueueCommandAsync(TerminalCommand terminalCommand) DispatchNewStateKey(); if (_textEditorService.ModelApi.GetOrDefault(new ResourceUri("terminalCommand" + '_' + terminalCommandKey)) is not null) - { - _textEditorService.PostIndependent( - "clear-content_" + terminalCommandKey.Guid, - editContext => - { - var commandOutputResourceUri = new ResourceUri("terminalCommand" + '_' + terminalCommandKey); - var modelModifier = editContext.GetModelModifier(commandOutputResourceUri); - - if (modelModifier is null) - return Task.CompletedTask; - - var textSpan = TextEditorTextSpan.FabricateTextSpan($"> {terminalCommand.FormattedCommand.Value}\n"); - - _terminalCommandTextSpanMap[terminalCommandKey] = textSpan; - - modelModifier.SetContent(textSpan.GetText()); - return Task.CompletedTask; - }); - } + ClearOutputView(terminalCommand); if (terminalCommand.BeginWith is not null) await terminalCommand.BeginWith.Invoke(); @@ -173,10 +156,12 @@ await command.Observe(_commandCancellationTokenSource.Token) switch (cmdEvent) { case StartedCommandEvent started: - output = $"{terminalCommand.FormattedCommand.Value}\n"; // + - // $"> PID:{started.ProcessId} PWD:{WorkingDirectoryAbsolutePathString}\n"; - - // output = null; + // TODO: If the source of the terminal command is a user having... + // ...typed themselves, then hitting enter, do not write this out. + // | + // This is here for when the command was started programmatically + // without a user typing into the terminal. + output = $"{terminalCommand.FormattedCommand.Value}\n"; break; case StandardOutputCommandEvent stdOut: output = $"{stdOut.Text}\n"; @@ -196,7 +181,13 @@ await command.Observe(_commandCancellationTokenSource.Token) if (terminalCommand.OutputParser is not null) outputTextSpanList = terminalCommand.OutputParser.ParseLine(output); - AddOutput(output, terminalCommand, terminalCommandBoundary, outputTextSpanList); + _textEditorService.Post(new OnOutput( + output, + outputTextSpanList, + ResourceUri, + _textEditorService, + terminalCommandBoundary, + TextEditorViewModelKey)); } DispatchNewStateKey(); @@ -532,60 +523,6 @@ await _textEditorService.ViewModelApi.MoveCursorFactory( }); } - public void AddOutput( - string output, - TerminalCommand terminalCommand, - TerminalCommandBoundary terminalCommandBoundary, - List outputTextSpanList) - { - _textEditorService.PostIndependent( - nameof(EnqueueCommandAsync), - async editContext => - { - var modelModifier = editContext.GetModelModifier(ResourceUri); - var viewModelModifier = editContext.GetViewModelModifier(TextEditorViewModelKey); - var cursorModifierBag = editContext.GetCursorModifierBag(viewModelModifier?.ViewModel); - var primaryCursorModifier = editContext.GetPrimaryCursorModifier(cursorModifierBag); - - if (modelModifier is null || viewModelModifier is null || cursorModifierBag is null || primaryCursorModifier is null) - return; - - var entryPositionIndex = modelModifier.GetPositionIndex(primaryCursorModifier); - terminalCommandBoundary.StartPositionIndexInclusive ??= entryPositionIndex; - - await _textEditorService.ModelApi.InsertTextFactory( - ResourceUri, - TextEditorViewModelKey, - output, - CancellationToken.None) - .Invoke(editContext) - .ConfigureAwait(false); - - var terminalCompilerService = (TerminalCompilerService)modelModifier.CompilerService; - if (terminalCompilerService.GetCompilerServiceResourceFor(modelModifier.ResourceUri) is not TerminalResource terminalResource) - return; - - outputTextSpanList = outputTextSpanList.Select(x => x with - { - StartingIndexInclusive = entryPositionIndex + x.StartingIndexInclusive, - EndingIndexExclusive = entryPositionIndex + x.EndingIndexExclusive, - ResourceUri = ResourceUri, - SourceText = modelModifier.GetAllText(), - }).ToList(); - - terminalResource.ManualDecorationTextSpanList.AddRange(outputTextSpanList); - terminalResource.ManualSymbolList.AddRange(outputTextSpanList.Select(x => new SourceFileSymbol(x))); - - await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( - modelModifier.ResourceUri, - terminalResource.GetTokenTextSpans()) - .Invoke(editContext) - .ConfigureAwait(false); - - terminalCommandBoundary.EndPositionIndexExclusive = modelModifier.GetPositionIndex(primaryCursorModifier); - }); - } - public void ClearTerminal() { _textEditorService.PostIndependent( @@ -623,4 +560,30 @@ await _textEditorService.ModelApi.DeleteTextByMotionFactory( terminalResource.SyntaxTokenList.Clear(); }); } + + /// + /// This method refers to a substring of the terminal output. + /// For example, the unit test explorer, will show terminal output, + /// which is the result of taking a substring from the entire terminal output. + /// + private void ClearOutputView(TerminalCommand terminalCommand) + { + _textEditorService.PostIndependent( + "clear-content_" + terminalCommand.TerminalCommandKey.Guid, + editContext => + { + var commandOutputResourceUri = new ResourceUri("terminalCommand" + '_' + terminalCommand.TerminalCommandKey); + var modelModifier = editContext.GetModelModifier(commandOutputResourceUri); + + if (modelModifier is null) + return Task.CompletedTask; + + var textSpan = TextEditorTextSpan.FabricateTextSpan($"> {terminalCommand.FormattedCommand.Value}\n"); + + _terminalCommandTextSpanMap[terminalCommand.TerminalCommandKey] = textSpan; + + modelModifier.SetContent(textSpan.GetText()); + return Task.CompletedTask; + }); + } } \ No newline at end of file diff --git a/Source/Lib/TextEditor/Events/BatchScrollEvents.cs b/Source/Lib/TextEditor/Events/BatchScrollEvents.cs deleted file mode 100644 index 2ea9027af..000000000 --- a/Source/Lib/TextEditor/Events/BatchScrollEvents.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Luthetus.Common.RazorLib.Reactives.Models; - -namespace Luthetus.TextEditor.RazorLib.Events; - -public class BatchScrollEvents -{ - public IThrottle ThrottleMutateScrollHorizontalPositionByPixels { get; } = new Throttle(IThrottle.DefaultThrottleTimeSpan); - public IThrottle ThrottleMutateScrollVerticalPositionByPixels { get; } = new Throttle(IThrottle.DefaultThrottleTimeSpan); - public IThrottle ThrottleSetScrollPosition { get; } = new Throttle(IThrottle.DefaultThrottleTimeSpan); - - public double MutateScrollHorizontalPositionByPixels { get; set; } - public double MutateScrollVerticalPositionByPixels { get; set; } -} \ No newline at end of file diff --git a/Source/Lib/TextEditor/Events/EventUtils.cs b/Source/Lib/TextEditor/Events/Models/EventUtils.cs similarity index 98% rename from Source/Lib/TextEditor/Events/EventUtils.cs rename to Source/Lib/TextEditor/Events/Models/EventUtils.cs index 086c095cb..f574082ed 100644 --- a/Source/Lib/TextEditor/Events/EventUtils.cs +++ b/Source/Lib/TextEditor/Events/Models/EventUtils.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Components.Web; using static Luthetus.TextEditor.RazorLib.TextEditors.Displays.TextEditorViewModelDisplay; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public static class EventUtils { diff --git a/Source/Lib/TextEditor/Events/OnDoubleClick.cs b/Source/Lib/TextEditor/Events/Models/OnDoubleClick.cs similarity index 98% rename from Source/Lib/TextEditor/Events/OnDoubleClick.cs rename to Source/Lib/TextEditor/Events/Models/OnDoubleClick.cs index 69780a3a1..32194026f 100644 --- a/Source/Lib/TextEditor/Events/OnDoubleClick.cs +++ b/Source/Lib/TextEditor/Events/Models/OnDoubleClick.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Components.Web; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnDoubleClick : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnKeyDown.cs b/Source/Lib/TextEditor/Events/Models/OnKeyDown.cs similarity index 99% rename from Source/Lib/TextEditor/Events/OnKeyDown.cs rename to Source/Lib/TextEditor/Events/Models/OnKeyDown.cs index 20de75645..833236bbd 100644 --- a/Source/Lib/TextEditor/Events/OnKeyDown.cs +++ b/Source/Lib/TextEditor/Events/Models/OnKeyDown.cs @@ -11,7 +11,7 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnKeyDown : ITextEditorTask { @@ -50,7 +50,7 @@ public OnKeyDown( public Key QueueKey { get; } = ContinuousBackgroundTaskWorker.GetQueueKey(); public string Name { get; } = nameof(OnKeyDown); public Task? WorkProgress { get; } - public TimeSpan ThrottleTimeSpan => TextEditorViewModelDisplay.TextEditorEvents.ThrottleDelayDefault; + public TimeSpan ThrottleTimeSpan => TextEditorEvents.ThrottleDelayDefault; public KeyboardEventArgs KeyboardEventArgs { get; } public CommandNoType? Command { get; } diff --git a/Source/Lib/TextEditor/Events/OnKeyDownBatch.cs b/Source/Lib/TextEditor/Events/Models/OnKeyDownBatch.cs similarity index 99% rename from Source/Lib/TextEditor/Events/OnKeyDownBatch.cs rename to Source/Lib/TextEditor/Events/Models/OnKeyDownBatch.cs index e0becf4cf..7ddfa5129 100644 --- a/Source/Lib/TextEditor/Events/OnKeyDownBatch.cs +++ b/Source/Lib/TextEditor/Events/Models/OnKeyDownBatch.cs @@ -8,7 +8,7 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnKeyDownBatch : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnMouseDown.cs b/Source/Lib/TextEditor/Events/Models/OnMouseDown.cs similarity index 98% rename from Source/Lib/TextEditor/Events/OnMouseDown.cs rename to Source/Lib/TextEditor/Events/Models/OnMouseDown.cs index a4672778c..b7db222b1 100644 --- a/Source/Lib/TextEditor/Events/OnMouseDown.cs +++ b/Source/Lib/TextEditor/Events/Models/OnMouseDown.cs @@ -7,7 +7,7 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnMouseDown : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnMouseMove.cs b/Source/Lib/TextEditor/Events/Models/OnMouseMove.cs similarity index 98% rename from Source/Lib/TextEditor/Events/OnMouseMove.cs rename to Source/Lib/TextEditor/Events/Models/OnMouseMove.cs index fe8b69440..f544d546c 100644 --- a/Source/Lib/TextEditor/Events/OnMouseMove.cs +++ b/Source/Lib/TextEditor/Events/Models/OnMouseMove.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Components.Web; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnMouseMove : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnScrollHorizontal.cs b/Source/Lib/TextEditor/Events/Models/OnScrollHorizontal.cs similarity index 97% rename from Source/Lib/TextEditor/Events/OnScrollHorizontal.cs rename to Source/Lib/TextEditor/Events/Models/OnScrollHorizontal.cs index be3180bce..ded67027a 100644 --- a/Source/Lib/TextEditor/Events/OnScrollHorizontal.cs +++ b/Source/Lib/TextEditor/Events/Models/OnScrollHorizontal.cs @@ -3,7 +3,7 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnScrollHorizontal : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnScrollVertical.cs b/Source/Lib/TextEditor/Events/Models/OnScrollVertical.cs similarity index 97% rename from Source/Lib/TextEditor/Events/OnScrollVertical.cs rename to Source/Lib/TextEditor/Events/Models/OnScrollVertical.cs index ab5dbf641..0e85e2248 100644 --- a/Source/Lib/TextEditor/Events/OnScrollVertical.cs +++ b/Source/Lib/TextEditor/Events/Models/OnScrollVertical.cs @@ -3,7 +3,7 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnScrollVertical : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnWheel.cs b/Source/Lib/TextEditor/Events/Models/OnWheel.cs similarity index 98% rename from Source/Lib/TextEditor/Events/OnWheel.cs rename to Source/Lib/TextEditor/Events/Models/OnWheel.cs index 7434026e0..f720fc569 100644 --- a/Source/Lib/TextEditor/Events/OnWheel.cs +++ b/Source/Lib/TextEditor/Events/Models/OnWheel.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Web; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnWheel : ITextEditorTask { diff --git a/Source/Lib/TextEditor/Events/OnWheelBatch.cs b/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs similarity index 98% rename from Source/Lib/TextEditor/Events/OnWheelBatch.cs rename to Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs index 139c47824..1581b14e3 100644 --- a/Source/Lib/TextEditor/Events/OnWheelBatch.cs +++ b/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components.Web; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -namespace Luthetus.TextEditor.RazorLib.Events; +namespace Luthetus.TextEditor.RazorLib.Events.Models; public class OnWheelBatch : ITextEditorTask { diff --git a/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarHorizontal.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarHorizontal.razor.cs index bb5a3908f..ab1a18a42 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarHorizontal.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarHorizontal.razor.cs @@ -3,7 +3,7 @@ using Luthetus.Common.RazorLib.Drags.Displays; using Luthetus.Common.RazorLib.JavaScriptObjects.Models; using Luthetus.Common.RazorLib.Reactives.Models; -using Luthetus.TextEditor.RazorLib.Events; +using Luthetus.TextEditor.RazorLib.Events.Models; using Luthetus.TextEditor.RazorLib.JsRuntimes.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; using Microsoft.AspNetCore.Components; diff --git a/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarVertical.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarVertical.razor.cs index bf88209bf..09790e85e 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarVertical.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/Internals/ScrollbarVertical.razor.cs @@ -3,7 +3,7 @@ using Luthetus.Common.RazorLib.Drags.Displays; using Luthetus.Common.RazorLib.JavaScriptObjects.Models; using Luthetus.Common.RazorLib.Reactives.Models; -using Luthetus.TextEditor.RazorLib.Events; +using Luthetus.TextEditor.RazorLib.Events.Models; using Luthetus.TextEditor.RazorLib.JsRuntimes.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; using Microsoft.AspNetCore.Components; diff --git a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs index b36d2d7b8..fe161b0d6 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs @@ -27,6 +27,7 @@ using Luthetus.TextEditor.RazorLib.Events; using Luthetus.TextEditor.RazorLib.Exceptions; using Luthetus.TextEditor.RazorLib.JsRuntimes.Models; +using Luthetus.TextEditor.RazorLib.Events.Models; namespace Luthetus.TextEditor.RazorLib.TextEditors.Displays; From 104f72c53609fd7ee9aecba6e5a66685b116f9e2 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 15:38:22 -0400 Subject: [PATCH 44/56] Fix: OnOutputBatch.cs syntax highlighting --- .../Ide.RazorLib/Events/Models/OnOutput.cs | 24 ++++++++++++++----- .../Events/Models/OnOutputBatch.cs | 24 +++++++++++++++---- .../Ide.RazorLib/Terminals/Models/Terminal.cs | 5 ++++ 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs index 9d8d4187f..7e29c4270 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs @@ -6,6 +6,7 @@ using Luthetus.TextEditor.RazorLib.Lexes.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; +using System.Collections.Generic; namespace Luthetus.Ide.RazorLib.Events.Models; @@ -24,6 +25,7 @@ public class OnOutput : ITextEditorTask private readonly TerminalCommandBoundary _terminalCommandBoundary; public OnOutput( + int outputOffset, string output, List outputTextSpanList, ResourceUri resourceUri, @@ -31,6 +33,7 @@ public OnOutput( TerminalCommandBoundary terminalCommandBoundary, Key viewModelKey) { + OutputOffset = outputOffset; Output = output; _outputTextSpanList = outputTextSpanList; ResourceUri = resourceUri; @@ -45,6 +48,7 @@ public OnOutput( public Key QueueKey { get; } = ContinuousBackgroundTaskWorker.GetQueueKey(); public string Name { get; } = nameof(OnOutput); public Task? WorkProgress { get; } + public int OutputOffset { get; } public string Output { get; } public ResourceUri ResourceUri { get; } public ITextEditorService TextEditorService { get; } @@ -101,25 +105,33 @@ await editContext.TextEditorService.ModelApi.ApplyDecorationRangeFactory( { if (oldEvent is OnOutput oldEventOnOutput) { - var outputList = new List + var localOutputList = new List { oldEventOnOutput.Output, Output }; + var localOutputTextSpanAndOffsetTupleList = new List<(int OutputOffset, List OutputTextSpan)> + { + (oldEventOnOutput.OutputOffset, oldEventOnOutput._outputTextSpanList), + (OutputOffset, _outputTextSpanList) + }; + return new OnOutputBatch( - outputList, - _outputTextSpanList, + oldEventOnOutput.OutputOffset, + localOutputList, + localOutputTextSpanAndOffsetTupleList, ResourceUri, TextEditorService, _terminalCommandBoundary, ViewModelKey); } - if (oldEvent is OnOutputBatch oldEventOnWheelBatch) + if (oldEvent is OnOutputBatch oldOnOutputBatch) { - oldEventOnWheelBatch.OutputList.Add(Output); - return oldEventOnWheelBatch; + oldOnOutputBatch.OutputList.Add(Output); + oldOnOutputBatch.OutputTextSpanAndOffsetTupleList.Add((OutputOffset, _outputTextSpanList)); + return oldOnOutputBatch; } return null; diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs index 5fe1bbcbb..bc0aa201f 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs @@ -5,6 +5,7 @@ using Luthetus.TextEditor.RazorLib; using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; +using System; namespace Luthetus.Ide.RazorLib.Events.Models; @@ -19,28 +20,31 @@ public class OnOutputBatch : ITextEditorTask private readonly TerminalCommandBoundary _terminalCommandBoundary; public OnOutputBatch( + int batchOutputOffset, List outputList, - List outputTextSpanList, + List<(int OutputOffset, List OutputTextSpan)> outputTextSpanAndOffsetTupleList, ResourceUri resourceUri, ITextEditorService textEditorService, TerminalCommandBoundary terminalCommandBoundary, Key viewModelKey) { + BatchOutputOffset = batchOutputOffset; OutputList = outputList; - _outputTextSpanList = outputTextSpanList; + OutputTextSpanAndOffsetTupleList = outputTextSpanAndOffsetTupleList; ResourceUri = resourceUri; TextEditorService = textEditorService; _terminalCommandBoundary = terminalCommandBoundary; ViewModelKey = viewModelKey; } - private List _outputTextSpanList; public Key BackgroundTaskKey { get; } = Key.NewKey(); public Key QueueKey { get; } = ContinuousBackgroundTaskWorker.GetQueueKey(); public string Name { get; } = nameof(OnOutput); public Task? WorkProgress { get; } + public int BatchOutputOffset { get; } public List OutputList { get; } + public List<(int OutputOffset, List OutputTextSpanList)> OutputTextSpanAndOffsetTupleList { get; } public ResourceUri ResourceUri { get; } public ITextEditorService TextEditorService { get; } public Key ViewModelKey { get; } @@ -49,9 +53,21 @@ public OnOutputBatch( public Task InvokeWithEditContext(IEditContext editContext) { + // Flatten 'OutputTextSpanAndOffsetTupleList' + var outputTextSpanList = new List(); + foreach (var tuple in OutputTextSpanAndOffsetTupleList) + { + outputTextSpanList.AddRange(tuple.OutputTextSpanList.Select(x => x with + { + StartingIndexInclusive = x.StartingIndexInclusive + tuple.OutputOffset - BatchOutputOffset, + EndingIndexExclusive = x.EndingIndexExclusive + tuple.OutputOffset - BatchOutputOffset, + })); + } + var onOutput = new OnOutput( + BatchOutputOffset, string.Join(string.Empty, OutputList), - _outputTextSpanList, + outputTextSpanList, ResourceUri, TextEditorService, _terminalCommandBoundary, diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index 858d15c6f..e6c268cce 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -148,6 +148,8 @@ public Task EnqueueCommandAsync(TerminalCommand terminalCommand) var terminalCommandBoundary = new TerminalCommandBoundary(); + var outputOffset = 0; + await command.Observe(_commandCancellationTokenSource.Token) .ForEachAsync(cmdEvent => { @@ -182,12 +184,15 @@ await command.Observe(_commandCancellationTokenSource.Token) outputTextSpanList = terminalCommand.OutputParser.ParseLine(output); _textEditorService.Post(new OnOutput( + outputOffset, output, outputTextSpanList, ResourceUri, _textEditorService, terminalCommandBoundary, TextEditorViewModelKey)); + + outputOffset += output.Length; } DispatchNewStateKey(); From e8c8b77279b1bd1884eb4e807e6d9576221acbf5 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 16:15:58 -0400 Subject: [PATCH 45/56] Git commit --- .../GitChangesTreeViewDisplay.razor.cs | 10 ++-- .../Gits/Displays/GitControlsDisplay.razor.cs | 44 +++++++++++---- .../Gits/Displays/GitDiffDisplay.razor | 7 +++ .../Gits/Displays/GitDiffDisplay.razor.cs | 55 +++++++++++++++++++ .../Models/GitTreeViewMouseEventHandler.cs | 55 +++++++++++++++++++ 5 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs index c0e518fbd..c8ecb5148 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesTreeViewDisplay.razor.cs @@ -32,8 +32,8 @@ public partial class GitChangesTreeViewDisplay : ComponentBase public GitState GitState { get; set; } = null!; private TreeViewCommandArgs? _mostRecentTreeViewCommandArgs; - private TreeViewKeyboardEventHandler _treeViewKeyboardEventHandler = null!; - private TreeViewMouseEventHandler _treeViewMouseEventHandler = null!; + private GitTreeViewKeyboardEventHandler _treeViewKeyboardEventHandler = null!; + private GitTreeViewMouseEventHandler _treeViewMouseEventHandler = null!; private int OffsetPerDepthInPixels => (int)Math.Ceiling( AppOptionsStateWrap.Value.Options.IconSizeInPixels * (2.0 / 3.0)); @@ -46,9 +46,11 @@ protected override void OnInitialized() GitStateWrap, Dispatcher); - _treeViewMouseEventHandler = new TreeViewMouseEventHandler( + _treeViewMouseEventHandler = new GitTreeViewMouseEventHandler( TreeViewService, - BackgroundTaskService); + BackgroundTaskService, + GitStateWrap, + Dispatcher); base.OnInitialized(); } diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index 0e46caf96..de1103f73 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -6,7 +6,6 @@ using Luthetus.Ide.RazorLib.Terminals.Models; using Luthetus.Ide.RazorLib.Terminals.States; using Microsoft.AspNetCore.Components; -using System.Collections.Immutable; using System.Text; namespace Luthetus.Ide.RazorLib.Gits.Displays; @@ -25,7 +24,8 @@ public partial class GitControlsDisplay : ComponentBase private string _summary = string.Empty; - public Key NewDotNetSolutionTerminalCommandKey { get; } = Key.NewKey(); + public Key GitStatusTerminalCommandKey { get; } = Key.NewKey(); + public Key GitCommitTerminalCommandKey { get; } = Key.NewKey(); private async Task ExecuteGitStatusTerminalCommandOnClick() { @@ -46,18 +46,14 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() var gitCliOutputParser = new GitCliOutputParser( Dispatcher, - GitState, + localGitState, EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), EnvironmentProvider); var gitStatusCommand = new TerminalCommand( - NewDotNetSolutionTerminalCommandKey, + GitStatusTerminalCommandKey, formattedCommand, parentDirectory.Value, - ContinueWith: () => - { - return Task.CompletedTask; - }, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -66,7 +62,8 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() private async Task SubmitOnClick(GitState localGitState) { - if (string.IsNullOrWhiteSpace(_summary)) + var localSummary = _summary; + if (string.IsNullOrWhiteSpace(localSummary)) return; if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) @@ -108,11 +105,36 @@ private async Task SubmitOnClick(GitState localGitState) }; var gitAddCommand = new TerminalCommand( - NewDotNetSolutionTerminalCommandKey, + GitStatusTerminalCommandKey, formattedCommand, - parentDirectory.Value); + parentDirectory.Value, + ContinueWith: () => CommitChanges(localGitState, localSummary)); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitAddCommand); } + + private async Task CommitChanges(GitState localGitState, string localSummary) + { + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + var argumentsString = $"commit -m \"{localSummary}\""; + + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { argumentsString }) + { + HACK_ArgumentsString = argumentsString + }; + + var gitCommitCommand = new TerminalCommand( + GitCommitTerminalCommandKey, + formattedCommand, + parentDirectory.Value); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitCommitCommand); + } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor new file mode 100644 index 000000000..dc533a597 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor @@ -0,0 +1,7 @@ +
+ GitDiffDisplay + + +
diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs new file mode 100644 index 000000000..b7db18df7 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs @@ -0,0 +1,55 @@ +using Fluxor; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Ide.RazorLib.CommandLines.Models; +using Luthetus.Ide.RazorLib.Gits.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.Ide.RazorLib.Terminals.States; +using Microsoft.AspNetCore.Components; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitDiffDisplay : ComponentBase +{ + [Inject] + private IState TerminalStateWrap { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; + [Inject] + private IState GitStateWrap { get; set; } = null!; + + [Parameter, EditorRequired] + public GitFile GitFile { get; set; } = null!; + + public Key GitLogTerminalCommandKey { get; } = Key.NewKey(); + + private async Task ShowOriginalFromGitOnClick() + { + var localGitState = GitStateWrap.Value; + var localGitFile = GitFile; + + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + + var gitLogArgs = $"log -p {localGitFile.RelativePathString}"; + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { gitLogArgs }) + { + HACK_ArgumentsString = gitLogArgs + }; + + var gitStatusCommand = new TerminalCommand( + GitLogTerminalCommandKey, + formattedCommand, + parentDirectory.Value); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitStatusCommand); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs new file mode 100644 index 000000000..95afb1657 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs @@ -0,0 +1,55 @@ +using Fluxor; +using Luthetus.Common.RazorLib.BackgroundTasks.Models; +using Luthetus.Common.RazorLib.Commands.Models; +using Luthetus.Common.RazorLib.Dialogs.Models; +using Luthetus.Common.RazorLib.Dialogs.States; +using Luthetus.Common.RazorLib.Dynamics.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Common.RazorLib.TreeViews.Models; +using Luthetus.Ide.RazorLib.Gits.Displays; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; +using System.Reactive; + +namespace Luthetus.Ide.RazorLib.Gits.Models; + +public class GitTreeViewMouseEventHandler : TreeViewMouseEventHandler +{ + private readonly IState _gitStateWrap; + private readonly IDispatcher _dispatcher; + + public GitTreeViewMouseEventHandler( + ITreeViewService treeViewService, + IBackgroundTaskService backgroundTaskService, + IState gitStateWrap, + IDispatcher dispatcher) + : base(treeViewService, backgroundTaskService) + { + _gitStateWrap = gitStateWrap; + _dispatcher = dispatcher; + } + + public override void OnDoubleClick(TreeViewCommandArgs commandArgs) + { + base.OnDoubleClick(commandArgs); + + if (commandArgs.NodeThatReceivedMouseEvent is not TreeViewGitFile treeViewGitFile) + return; + + var dialogViewModel = new DialogViewModel( + Key.NewKey(), + $"Diff: {treeViewGitFile.Item.AbsolutePath.NameWithExtension}", + typeof(GitDiffDisplay), + new Dictionary + { + { + nameof(GitDiffDisplay.GitFile), + treeViewGitFile.Item + } + }, + null, + true); + + _dispatcher.Dispatch(new DialogState.RegisterAction(dialogViewModel)); + } +} From 41c4189366159c475aa45a45daf72b90a728ef7a Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 16:39:59 -0400 Subject: [PATCH 46/56] Add: GetOriginOnClick() --- .../Gits/Displays/GitControlsDisplay.razor | 5 + .../Gits/Displays/GitControlsDisplay.razor.cs | 19 +++- .../Gits/Displays/GitOriginDisplay.razor | 41 ++++++++ .../Gits/Displays/GitOriginDisplay.razor.cs | 94 +++++++++++++++++++ .../Ide.RazorLib/Gits/States/GitState.Main.cs | 5 +- .../Terminals/Models/GitCliOutputParser.cs | 23 ++++- 6 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor index 9aced2e1b..cc24ee9df 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor @@ -7,6 +7,11 @@ Status + + .NewKey(), + $"Git Origin", + typeof(GitOriginDisplay), + null, + null, + true); + + Dispatcher.Dispatch(new DialogState.RegisterAction(dialogViewModel)); + } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor new file mode 100644 index 000000000..daee7c5de --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor @@ -0,0 +1,41 @@ +
+ + @{ var localGitState = GitStateWrap.Value; } + + + +
+ + Origin: + + @if (string.IsNullOrWhiteSpace(localGitState.Origin)) + { + @: string.IsNullOrWhiteSpace(localGitState.Origin) + } + else + { + @localGitState.Origin + } + +
+ +
+ +
+ @{ var localCommandArgs = CommandArgs; } + + @localCommandArgs +
+ + +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs new file mode 100644 index 000000000..01ae58c2f --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs @@ -0,0 +1,94 @@ +using Fluxor; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.Keys.Models; +using Luthetus.Ide.RazorLib.CommandLines.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.Terminals.Models; +using Luthetus.Ide.RazorLib.Terminals.States; +using Microsoft.AspNetCore.Components; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitOriginDisplay : ComponentBase +{ + [Inject] + private IState GitStateWrap { get; set; } = null!; + [Inject] + private IState TerminalStateWrap { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; + + private string _gitOrigin = string.Empty; + + public Key GitSetOriginTerminalCommandKey { get; } = Key.NewKey(); + + private string CommandArgs => $"remote add origin \"{_gitOrigin}\""; + + private async Task GetOriginOnClick() + { + var localGitState = GitStateWrap.Value; + + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + + var localCommandArgs = "config --get remote.origin.url"; + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { localCommandArgs }) + { + HACK_ArgumentsString = localCommandArgs + }; + + var gitCliOutputParser = new GitCliOutputParser( + Dispatcher, + localGitState, + EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), + EnvironmentProvider, + stageKind: GitCliOutputParser.StageKind.GetOrigin); + + var gitStatusCommand = new TerminalCommand( + GitSetOriginTerminalCommandKey, + formattedCommand, + parentDirectory.Value, + OutputParser: gitCliOutputParser); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitStatusCommand); + } + + private async Task SetGitOriginOnClick(string localCommandArgs) + { + var localGitState = GitStateWrap.Value; + + if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + return; + + var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; + + var formattedCommand = new FormattedCommand( + GitCliFacts.TARGET_FILE_NAME, + new string[] { localCommandArgs }) + { + HACK_ArgumentsString = localCommandArgs + }; + + var gitCliOutputParser = new GitCliOutputParser( + Dispatcher, + localGitState, + EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), + EnvironmentProvider); + + var gitStatusCommand = new TerminalCommand( + GitSetOriginTerminalCommandKey, + formattedCommand, + parentDirectory.Value, + OutputParser: gitCliOutputParser); + + var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; + await generalTerminal.EnqueueCommandAsync(gitStatusCommand); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 659ba9237..1ea1534b9 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -12,12 +12,13 @@ public partial record GitState( IAbsolutePath? GitFolderAbsolutePath, ImmutableList GitFileList, ImmutableDictionary StagedGitFileMap, - ImmutableList ActiveGitTasks) + ImmutableList ActiveGitTasks, + string? Origin) { public static readonly Key TreeViewGitChangesKey = Key.NewKey(); public GitState() - : this(null, ImmutableList.Empty, ImmutableDictionary.Empty, ImmutableList.Empty) + : this(null, ImmutableList.Empty, ImmutableDictionary.Empty, ImmutableList.Empty, null) { } diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index 972916419..7cfd6569c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -20,12 +20,14 @@ public GitCliOutputParser( IDispatcher dispatcher, GitState gitState, IAbsolutePath workingDirectory, - IEnvironmentProvider environmentProvider) + IEnvironmentProvider environmentProvider, + StageKind stageKind = StageKind.None) { _dispatcher = dispatcher; _gitState = gitState; _workingDirectoryAbsolutePath = workingDirectory; _environmentProvider = environmentProvider; + _stageKind = stageKind; } private StageKind _stageKind = StageKind.None; @@ -37,6 +39,9 @@ public List ParseLine(string output) if (_gitState.GitFolderAbsolutePath is null) return new(); + if (_stageKind == StageKind.GetOrigin) + return ParseOriginLine(output); + var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); var textSpanList = new List(); @@ -151,6 +156,19 @@ public List ParseLine(string output) return textSpanList; } + private List ParseOriginLine(string output) + { + var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); + var textSpanList = new List(); + + while (!stringWalker.IsEof) + { + _ = stringWalker.ReadCharacter(); + } + + return textSpanList; + } + public void Dispose() { if (_gitState.GitFolderAbsolutePath is null) @@ -161,9 +179,10 @@ public void Dispose() GitFileList.ToImmutableList())); } - private enum StageKind + public enum StageKind { None, IsReadingUntrackedFiles, + GetOrigin, } } \ No newline at end of file From ef7d77c277fdcf4a37b6ea82f3df1f66bac25f91 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 16:48:18 -0400 Subject: [PATCH 47/56] Add: ParseOriginLine(string output) --- .../Gits/States/GitState.Actions.cs | 1 + .../Gits/States/GitState.Reducer.cs | 18 +++++++++++++++ .../Terminals/Models/GitCliOutputParser.cs | 23 ++++++++++++++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs index 62dde12b7..1360b0726 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs @@ -10,6 +10,7 @@ public partial record GitState /// If the expected path is not the actual path, then the git file list will NOT be changed. /// public record SetGitFileListAction(IAbsolutePath ExpectedGitFolderAbsolutePath, ImmutableList GitFileList); + public record SetGitOriginAction(IAbsolutePath ExpectedGitFolderAbsolutePath, string Origin); public record SetGitFolderAction(IAbsolutePath GitFolderAbsolutePath); public record SetSelectedGitFileListAction(Func, ImmutableDictionary> SetSelectedGitFileListFunc); public record SetGitStateWithAction(Func GitStateWithFunc); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index 6dcc5d05f..a82e6473c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -25,6 +25,24 @@ public static GitState ReduceSetGitFileListAction( GitFileList = setGitFileListAction.GitFileList }; } + + [ReducerMethod] + public static GitState ReduceSetGitOriginAction( + GitState inState, + SetGitOriginAction setGitOriginAction) + { + if (inState.GitFolderAbsolutePath != setGitOriginAction.ExpectedGitFolderAbsolutePath) + { + // Git folder was changed while the text was being parsed, + // throw away the result since it is thereby invalid. + return inState; + } + + return inState with + { + Origin = setGitOriginAction.Origin + }; + } [ReducerMethod] public static GitState ReduceSetGitFolderAction( diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index 7cfd6569c..5f49c38d2 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -32,6 +32,10 @@ public GitCliOutputParser( private StageKind _stageKind = StageKind.None; + private string? _origin; + + private int _count; + public List GitFileList { get; } = new(); public List ParseLine(string output) @@ -158,6 +162,10 @@ public List ParseLine(string output) private List ParseOriginLine(string output) { + // TODO: Parsing origin line is super hacky, and should be re-written. + if (_count++ == 1) + _origin ??= output; + var stringWalker = new StringWalker(new ResourceUri("/__LUTHETUS__/GitCliOutputParser.txt"), output); var textSpanList = new List(); @@ -174,9 +182,18 @@ public void Dispose() if (_gitState.GitFolderAbsolutePath is null) return; - _dispatcher.Dispatch(new GitState.SetGitFileListAction( - _gitState.GitFolderAbsolutePath, - GitFileList.ToImmutableList())); + if (_stageKind == StageKind.GetOrigin && _origin is not null) + { + _dispatcher.Dispatch(new GitState.SetGitOriginAction( + _gitState.GitFolderAbsolutePath, + _origin)); + } + else + { + _dispatcher.Dispatch(new GitState.SetGitFileListAction( + _gitState.GitFolderAbsolutePath, + GitFileList.ToImmutableList())); + } } public enum StageKind From 6d363497a756d58869b5c41c973940d8563ff9a5 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Fri, 3 May 2024 17:24:50 -0400 Subject: [PATCH 48/56] Fix: text editor scrolling with mouse wheel --- .../Lib/TextEditor/Events/Models/OnWheel.cs | 67 ++++++++++++++++--- .../TextEditor/Events/Models/OnWheelBatch.cs | 16 +++-- .../Displays/Internals/RowSection.razor.cs | 25 +++---- .../TextEditorViewModelDisplay.razor.cs | 6 ++ 4 files changed, 86 insertions(+), 28 deletions(-) diff --git a/Source/Lib/TextEditor/Events/Models/OnWheel.cs b/Source/Lib/TextEditor/Events/Models/OnWheel.cs index f720fc569..c909b2354 100644 --- a/Source/Lib/TextEditor/Events/Models/OnWheel.cs +++ b/Source/Lib/TextEditor/Events/Models/OnWheel.cs @@ -53,22 +53,69 @@ await viewModelModifier.ViewModel.MutateScrollVerticalPositionByPixelsFactory(Wh public IBackgroundTask? BatchOrDefault(IBackgroundTask oldEvent) { + // If the two individuals, or a batch and an individual are both positive, + // then batch them, etc... for negative and 0 + if (oldEvent is OnWheel oldEventOnWheel) { - return new OnWheelBatch( - new List() - { - oldEventOnWheel.WheelEventArgs, - WheelEventArgs - }, - _events, - ViewModelKey); + if (oldEventOnWheel.WheelEventArgs.DeltaY > 0 && + WheelEventArgs.DeltaY > 0) + { + return new OnWheelBatch( + new List() + { + oldEventOnWheel.WheelEventArgs, + WheelEventArgs + }, + _events, + ViewModelKey); + } + else if (oldEventOnWheel.WheelEventArgs.DeltaY < 0 && + WheelEventArgs.DeltaY < 0) + { + return new OnWheelBatch( + new List() + { + oldEventOnWheel.WheelEventArgs, + WheelEventArgs + }, + _events, + ViewModelKey); + } + else if (oldEventOnWheel.WheelEventArgs.DeltaY == 0 && + WheelEventArgs.DeltaY == 0) + { + return new OnWheelBatch( + new List() + { + oldEventOnWheel.WheelEventArgs, + WheelEventArgs + }, + _events, + ViewModelKey); + } } if (oldEvent is OnWheelBatch oldEventOnWheelBatch) { - oldEventOnWheelBatch.WheelEventArgsList.Add(WheelEventArgs); - return oldEventOnWheelBatch; + if (oldEventOnWheelBatch.WheelEventArgsList.Last().DeltaY > 0 && + WheelEventArgs.DeltaY > 0) + { + oldEventOnWheelBatch.WheelEventArgsList.Add(WheelEventArgs); + return oldEventOnWheelBatch; + } + else if (oldEventOnWheelBatch.WheelEventArgsList.Last().DeltaY < 0 && + WheelEventArgs.DeltaY < 0) + { + oldEventOnWheelBatch.WheelEventArgsList.Add(WheelEventArgs); + return oldEventOnWheelBatch; + } + else if (oldEventOnWheelBatch.WheelEventArgsList.Last().DeltaY == 0 && + WheelEventArgs.DeltaY == 0) + { + oldEventOnWheelBatch.WheelEventArgsList.Add(WheelEventArgs); + return oldEventOnWheelBatch; + } } return null; diff --git a/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs b/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs index 1581b14e3..087e64e93 100644 --- a/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs +++ b/Source/Lib/TextEditor/Events/Models/OnWheelBatch.cs @@ -57,17 +57,21 @@ public Task InvokeWithEditContext(IEditContext editContext) if (horizontalMutateScrollPositionByPixels is not null) { _events.TextEditorService.ViewModelApi.MutateScrollHorizontalPositionFactory( - viewModelModifier.ViewModel.BodyElementId, - viewModelModifier.ViewModel.GutterElementId, - horizontalMutateScrollPositionByPixels.Value); + viewModelModifier.ViewModel.BodyElementId, + viewModelModifier.ViewModel.GutterElementId, + horizontalMutateScrollPositionByPixels.Value) + .Invoke(editContext) + .ConfigureAwait(false); } if (verticalMutateScrollPositionByPixels is not null) { _events.TextEditorService.ViewModelApi.MutateScrollVerticalPositionFactory( - viewModelModifier.ViewModel.BodyElementId, - viewModelModifier.ViewModel.GutterElementId, - verticalMutateScrollPositionByPixels.Value); + viewModelModifier.ViewModel.BodyElementId, + viewModelModifier.ViewModel.GutterElementId, + verticalMutateScrollPositionByPixels.Value) + .Invoke(editContext) + .ConfigureAwait(false); } return Task.CompletedTask; diff --git a/Source/Lib/TextEditor/TextEditors/Displays/Internals/RowSection.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/Internals/RowSection.razor.cs index 50680fba7..7848ee82e 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/Internals/RowSection.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/Internals/RowSection.razor.cs @@ -38,7 +38,7 @@ public partial class RowSection : ComponentBase public CursorDisplay? CursorDisplayComponent { get; private set; } - private IThrottle _throttleVirtualizationDisplayItemsProviderFunc = new Throttle(TimeSpan.FromMilliseconds(60)); + private IThrottle _throttleVirtualizationDisplayItemsProviderFunc = new Throttle(TimeSpan.Zero);//new Throttle(TimeSpan.FromMilliseconds(60)); private string GetRowStyleCss(int index, double? virtualizedRowLeftInPixels) { @@ -108,16 +108,17 @@ private void VirtualizationDisplayItemsProviderFunc(VirtualizationRequest virtua if (model is null || viewModel is null) return; - _throttleVirtualizationDisplayItemsProviderFunc.PushEvent(_ => - { - TextEditorService.PostIndependent( - nameof(VirtualizationDisplayItemsProviderFunc), - TextEditorService.ViewModelApi.CalculateVirtualizationResultFactory( - model.ResourceUri, - viewModel.ViewModelKey, - virtualizationRequest.CancellationToken)); - - return Task.CompletedTask; - }); + TextEditorService.PostRedundant( + nameof(VirtualizationDisplayItemsProviderFunc), + $"{nameof(VirtualizationDisplayItemsProviderFunc)}_{viewModel.ViewModelKey}", + TextEditorService.ViewModelApi.CalculateVirtualizationResultFactory( + model.ResourceUri, + viewModel.ViewModelKey, + virtualizationRequest.CancellationToken)); + //_throttleVirtualizationDisplayItemsProviderFunc.PushEvent(_ => + //{ + + // return Task.CompletedTask; + //}); } } \ No newline at end of file diff --git a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs index fe161b0d6..8489d7d67 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs @@ -303,12 +303,18 @@ private void ReceiveContentOnMouseDown(MouseEventArgs mouseEventArgs) { _events.ThinksLeftMouseButtonIsDown = true; + var modelResourceUri = GetModel()?.ResourceUri; + var viewModel = GetViewModel(); + var viewModelKey = GetViewModel()?.ViewModelKey; if (modelResourceUri is null || viewModelKey is null) return; + if (viewModel is not null) + viewModel.UnsafeState.ShouldRevealCursor = false; + var onMouseDown = new OnMouseDown( mouseEventArgs, _events, From 3f1ff510c534e64ec1b7dca3aca59c8756ff9edc Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sat, 4 May 2024 18:14:44 -0400 Subject: [PATCH 49/56] Change: _throttleShouldRevealCursor to 333ms --- .../TextEditors/Displays/Internals/CursorDisplay.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Lib/TextEditor/TextEditors/Displays/Internals/CursorDisplay.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/Internals/CursorDisplay.razor.cs index 4faf40a1a..15b0e7714 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/Internals/CursorDisplay.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/Internals/CursorDisplay.razor.cs @@ -43,7 +43,7 @@ public partial class CursorDisplay : ComponentBase, IDisposable public RenderFragment AutoCompleteMenuRenderFragment { get; set; } = null!; private readonly Guid _intersectionObserverMapKey = Guid.NewGuid(); - private readonly IThrottle _throttleShouldRevealCursor = new Throttle(TimeSpan.FromMilliseconds(1_000)); + private readonly IThrottle _throttleShouldRevealCursor = new Throttle(TimeSpan.FromMilliseconds(333)); private ElementReference? _cursorDisplayElementReference; private MenuKind _menuKind; From f5ebfcb13f509979b5d5682fb82577c5bd7771b8 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sat, 4 May 2024 18:49:43 -0400 Subject: [PATCH 50/56] Add: GitRepo.cs --- .../Gits/Displays/GitControlsDisplay.razor.cs | 22 ++++++---------- .../Gits/Displays/GitDiffDisplay.razor.cs | 6 ++--- .../Gits/Displays/GitDisplay.razor | 12 ++++----- .../Gits/Displays/GitOriginDisplay.razor.cs | 14 +++------- .../Displays/GitPickGitFolderDisplay.razor.cs | 12 +++++++-- .../Ide/Ide.RazorLib/Gits/Models/GitRepo.cs | 5 ++++ .../Models/GitTreeViewKeyboardEventHandler.cs | 12 ++++----- .../Gits/States/GitState.Actions.cs | 13 +++++----- .../Gits/States/GitState.Effector.cs | 4 +-- .../Ide.RazorLib/Gits/States/GitState.Main.cs | 9 +++---- .../Gits/States/GitState.Reducer.cs | 26 +++++++++---------- .../Terminals/Models/GitCliOutputParser.cs | 17 +++++------- .../Displays/TreeViewGitFileDisplay.razor.cs | 16 ++++++------ .../Basis/Gits/States/GitStateActionsTests.cs | 2 +- .../Basis/Gits/States/GitStateReducerTests.cs | 2 +- 15 files changed, 83 insertions(+), 89 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index 10935f745..fccb8388c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -34,11 +34,9 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() { var localGitState = GitState; - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; - var gitStatusDashUCommand = $"{GitCliFacts.STATUS_COMMAND} -u"; var formattedCommand = new FormattedCommand( GitCliFacts.TARGET_FILE_NAME, @@ -50,13 +48,12 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() var gitCliOutputParser = new GitCliOutputParser( Dispatcher, localGitState, - EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), EnvironmentProvider); var gitStatusCommand = new TerminalCommand( GitStatusTerminalCommandKey, formattedCommand, - parentDirectory.Value, + localGitState.Repo.RepoFolderAbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -69,17 +66,15 @@ private async Task SubmitOnClick(GitState localGitState) if (string.IsNullOrWhiteSpace(localSummary)) return; - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; - var filesBuilder = new StringBuilder(); - foreach (var fileAbsolutePath in localGitState.StagedGitFileMap.Values) + foreach (var fileAbsolutePath in localGitState.StagedFileMap.Values) { var relativePathString = PathHelper.GetRelativeFromTwoAbsolutes( - EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), + localGitState.Repo.RepoFolderAbsolutePath, fileAbsolutePath.AbsolutePath, EnvironmentProvider); @@ -110,7 +105,7 @@ private async Task SubmitOnClick(GitState localGitState) var gitAddCommand = new TerminalCommand( GitStatusTerminalCommandKey, formattedCommand, - parentDirectory.Value, + localGitState.Repo.RepoFolderAbsolutePath.Value, ContinueWith: () => CommitChanges(localGitState, localSummary)); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -119,10 +114,9 @@ private async Task SubmitOnClick(GitState localGitState) private async Task CommitChanges(GitState localGitState, string localSummary) { - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; var argumentsString = $"commit -m \"{localSummary}\""; var formattedCommand = new FormattedCommand( @@ -135,7 +129,7 @@ private async Task CommitChanges(GitState localGitState, string localSummary) var gitCommitCommand = new TerminalCommand( GitCommitTerminalCommandKey, formattedCommand, - parentDirectory.Value, + localGitState.Repo.RepoFolderAbsolutePath.Value, ContinueWith: ExecuteGitStatusTerminalCommandOnClick); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs index b7db18df7..df77f419c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs @@ -31,11 +31,9 @@ private async Task ShowOriginalFromGitOnClick() var localGitState = GitStateWrap.Value; var localGitFile = GitFile; - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; - var gitLogArgs = $"log -p {localGitFile.RelativePathString}"; var formattedCommand = new FormattedCommand( GitCliFacts.TARGET_FILE_NAME, @@ -47,7 +45,7 @@ private async Task ShowOriginalFromGitOnClick() var gitStatusCommand = new TerminalCommand( GitLogTerminalCommandKey, formattedCommand, - parentDirectory.Value); + localGitState.Repo.RepoFolderAbsolutePath.Value); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitStatusCommand); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor index de5df996f..139a3d473 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor @@ -7,25 +7,25 @@ ClassCssString="luth_ide_solution-explorer-display" StyleCssString="height: 100%"> - @{ var gitState = GitStateWrap.Value; } + @{ var localGitState = GitStateWrap.Value; }
Git Changes
- - @if (gitState.GitFolderAbsolutePath is null) + + @if (localGitState.Repo is null) { } else {
- You have chosen: @gitState.GitFolderAbsolutePath + @localGitState.Repo.RepoFolderAbsolutePath.NameNoExtension
- - + + }
diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs index 01ae58c2f..e2e701c37 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs @@ -30,11 +30,9 @@ private async Task GetOriginOnClick() { var localGitState = GitStateWrap.Value; - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; - var localCommandArgs = "config --get remote.origin.url"; var formattedCommand = new FormattedCommand( GitCliFacts.TARGET_FILE_NAME, @@ -46,14 +44,13 @@ private async Task GetOriginOnClick() var gitCliOutputParser = new GitCliOutputParser( Dispatcher, localGitState, - EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), EnvironmentProvider, stageKind: GitCliOutputParser.StageKind.GetOrigin); var gitStatusCommand = new TerminalCommand( GitSetOriginTerminalCommandKey, formattedCommand, - parentDirectory.Value, + localGitState.Repo.RepoFolderAbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -64,11 +61,9 @@ private async Task SetGitOriginOnClick(string localCommandArgs) { var localGitState = GitStateWrap.Value; - if (localGitState.GitFolderAbsolutePath?.ParentDirectory is null) + if (localGitState.Repo is null) return; - var parentDirectory = localGitState.GitFolderAbsolutePath.ParentDirectory; - var formattedCommand = new FormattedCommand( GitCliFacts.TARGET_FILE_NAME, new string[] { localCommandArgs }) @@ -79,13 +74,12 @@ private async Task SetGitOriginOnClick(string localCommandArgs) var gitCliOutputParser = new GitCliOutputParser( Dispatcher, localGitState, - EnvironmentProvider.AbsolutePathFactory(parentDirectory.Value, true), EnvironmentProvider); var gitStatusCommand = new TerminalCommand( GitSetOriginTerminalCommandKey, formattedCommand, - parentDirectory.Value, + localGitState.Repo.RepoFolderAbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 1b01bb6ac..cc9a9e260 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -1,5 +1,6 @@ using Fluxor; using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.InputFiles.Models; using Luthetus.Ide.RazorLib.InputFiles.States; @@ -49,7 +50,14 @@ private void RequestInputFileForGitFolder() private void ConfirmGitFolderOnClick() { - Dispatcher.Dispatch(new GitState.SetGitFolderAction( - EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true))); + var gitFolder = EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true); + + if (gitFolder.ParentDirectory is null) + return; + + var workingDirectory = EnvironmentProvider.AbsolutePathFactory(gitFolder.ParentDirectory.Value, true); + + Dispatcher.Dispatch(new GitState.SetRepoAction( + new GitRepo(workingDirectory, gitFolder))); } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs new file mode 100644 index 000000000..96cb453e3 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs @@ -0,0 +1,5 @@ +using Luthetus.Common.RazorLib.FileSystems.Models; + +namespace Luthetus.Ide.RazorLib.Gits.Models; + +public record GitRepo(IAbsolutePath RepoFolderAbsolutePath, IAbsolutePath GitFolderAbsolutePath); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs index f26ec8b03..b77d89a91 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewKeyboardEventHandler.cs @@ -35,15 +35,15 @@ public override void OnKeyDown(TreeViewCommandArgs commandArgs) { var localGitState = _gitStateWrap.Value; - _dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + _dispatcher.Dispatch(new GitState.WithAction(inState => { - if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) + if (inState.Repo != localGitState.Repo) { // Git folder was changed, throw away the result since it is thereby invalid. return inState; } - var outStagedGitFileMap = new Dictionary(inState.StagedGitFileMap); + var outStagedFileMap = new Dictionary(inState.StagedFileMap); foreach (var selectedNode in commandArgs.TreeViewContainer.SelectedNodeList) { @@ -51,15 +51,15 @@ public override void OnKeyDown(TreeViewCommandArgs commandArgs) { var key = treeViewGitFile.Item.AbsolutePath.Value; - var wasRemoved = outStagedGitFileMap.Remove(key); + var wasRemoved = outStagedFileMap.Remove(key); if (!wasRemoved) - outStagedGitFileMap.Add(key, treeViewGitFile.Item); + outStagedFileMap.Add(key, treeViewGitFile.Item); } } return inState with { - StagedGitFileMap = outStagedGitFileMap.ToImmutableDictionary() + StagedFileMap = outStagedFileMap.ToImmutableDictionary() }; })); } diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs index 1360b0726..1e2d6c845 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Actions.cs @@ -1,5 +1,4 @@ -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Ide.RazorLib.Gits.Models; +using Luthetus.Ide.RazorLib.Gits.Models; using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Gits.States; @@ -9,9 +8,9 @@ public partial record GitState /// /// If the expected path is not the actual path, then the git file list will NOT be changed. /// - public record SetGitFileListAction(IAbsolutePath ExpectedGitFolderAbsolutePath, ImmutableList GitFileList); - public record SetGitOriginAction(IAbsolutePath ExpectedGitFolderAbsolutePath, string Origin); - public record SetGitFolderAction(IAbsolutePath GitFolderAbsolutePath); - public record SetSelectedGitFileListAction(Func, ImmutableDictionary> SetSelectedGitFileListFunc); - public record SetGitStateWithAction(Func GitStateWithFunc); + public record SetFileListAction(GitRepo Repo, ImmutableList FileList); + public record SetOriginAction(GitRepo Repo, string Origin); + public record SetRepoAction(GitRepo? Repo); + public record SetSelectedFileListAction(Func, ImmutableDictionary> SetSelectedFileListFunc); + public record WithAction(Func WithFunc); } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs index 5dd4b2d47..97cae9e51 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Effector.cs @@ -26,7 +26,7 @@ public Effector( _treeViewService = treeViewService; } - [EffectMethod(typeof(SetGitFileListAction))] + [EffectMethod(typeof(SetFileListAction))] public Task HandleSetGitStateWithAction(IDispatcher dispatcher) { // Suppress unused variable warning @@ -36,7 +36,7 @@ public Task HandleSetGitStateWithAction(IDispatcher dispatcher) { var gitState = _gitStateWrap.Value; - var treeViewList = gitState.GitFileList.Select(x => new TreeViewGitFile( + var treeViewList = gitState.FileList.Select(x => new TreeViewGitFile( x, _ideComponentRenderers, false, diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs index 1ea1534b9..7eb3950e4 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Main.cs @@ -1,5 +1,4 @@ using Fluxor; -using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Common.RazorLib.TreeViews.Models; using Luthetus.Ide.RazorLib.Gits.Models; @@ -9,10 +8,10 @@ namespace Luthetus.Ide.RazorLib.Gits.States; [FeatureState] public partial record GitState( - IAbsolutePath? GitFolderAbsolutePath, - ImmutableList GitFileList, - ImmutableDictionary StagedGitFileMap, - ImmutableList ActiveGitTasks, + GitRepo? Repo, + ImmutableList FileList, + ImmutableDictionary StagedFileMap, + ImmutableList ActiveTasks, string? Origin) { public static readonly Key TreeViewGitChangesKey = Key.NewKey(); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs index a82e6473c..222d4891c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/States/GitState.Reducer.cs @@ -11,9 +11,9 @@ public class Reducer [ReducerMethod] public static GitState ReduceSetGitFileListAction( GitState inState, - SetGitFileListAction setGitFileListAction) + SetFileListAction setGitFileListAction) { - if (inState.GitFolderAbsolutePath != setGitFileListAction.ExpectedGitFolderAbsolutePath) + if (inState.Repo != setGitFileListAction.Repo) { // Git folder was changed while the text was being parsed, // throw away the result since it is thereby invalid. @@ -22,16 +22,16 @@ public static GitState ReduceSetGitFileListAction( return inState with { - GitFileList = setGitFileListAction.GitFileList + FileList = setGitFileListAction.FileList }; } [ReducerMethod] public static GitState ReduceSetGitOriginAction( GitState inState, - SetGitOriginAction setGitOriginAction) + SetOriginAction setOriginAction) { - if (inState.GitFolderAbsolutePath != setGitOriginAction.ExpectedGitFolderAbsolutePath) + if (inState.Repo != setOriginAction.Repo) { // Git folder was changed while the text was being parsed, // throw away the result since it is thereby invalid. @@ -40,30 +40,30 @@ public static GitState ReduceSetGitOriginAction( return inState with { - Origin = setGitOriginAction.Origin + Origin = setOriginAction.Origin }; } [ReducerMethod] public static GitState ReduceSetGitFolderAction( GitState inState, - SetGitFolderAction setGitFolderAction) + SetRepoAction setRepoAction) { return inState with { - GitFolderAbsolutePath = setGitFolderAction.GitFolderAbsolutePath, - GitFileList = ImmutableList.Empty, - StagedGitFileMap = ImmutableDictionary.Empty, - ActiveGitTasks = ImmutableList.Empty, + Repo = setRepoAction.Repo, + FileList = ImmutableList.Empty, + StagedFileMap = ImmutableDictionary.Empty, + ActiveTasks = ImmutableList.Empty, }; } [ReducerMethod] public static GitState ReduceSetGitStateWithAction( GitState inState, - SetGitStateWithAction setGitStateWithAction) + WithAction withAction) { - return setGitStateWithAction.GitStateWithFunc.Invoke(inState); + return withAction.WithFunc.Invoke(inState); } } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index 5f49c38d2..c3b4d6a1c 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -13,19 +13,16 @@ public class GitCliOutputParser : IOutputParser { private readonly IDispatcher _dispatcher; private readonly GitState _gitState; - private readonly IAbsolutePath _workingDirectoryAbsolutePath; private readonly IEnvironmentProvider _environmentProvider; public GitCliOutputParser( IDispatcher dispatcher, GitState gitState, - IAbsolutePath workingDirectory, IEnvironmentProvider environmentProvider, StageKind stageKind = StageKind.None) { _dispatcher = dispatcher; _gitState = gitState; - _workingDirectoryAbsolutePath = workingDirectory; _environmentProvider = environmentProvider; _stageKind = stageKind; } @@ -40,7 +37,7 @@ public GitCliOutputParser( public List ParseLine(string output) { - if (_gitState.GitFolderAbsolutePath is null) + if (_gitState.Repo is null) return new(); if (_stageKind == StageKind.GetOrigin) @@ -132,7 +129,7 @@ public List ParseLine(string output) var relativePathString = textSpan.GetText(); var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( - _workingDirectoryAbsolutePath, + _gitState.Repo.RepoFolderAbsolutePath, relativePathString, _environmentProvider); @@ -179,19 +176,19 @@ private List ParseOriginLine(string output) public void Dispose() { - if (_gitState.GitFolderAbsolutePath is null) + if (_gitState.Repo is null) return; if (_stageKind == StageKind.GetOrigin && _origin is not null) { - _dispatcher.Dispatch(new GitState.SetGitOriginAction( - _gitState.GitFolderAbsolutePath, + _dispatcher.Dispatch(new GitState.SetOriginAction( + _gitState.Repo, _origin)); } else { - _dispatcher.Dispatch(new GitState.SetGitFileListAction( - _gitState.GitFolderAbsolutePath, + _dispatcher.Dispatch(new GitState.SetFileListAction( + _gitState.Repo, GitFileList.ToImmutableList())); } } diff --git a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs index e2fa8c81c..354adb0e5 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TreeViewImplementations/Displays/TreeViewGitFileDisplay.razor.cs @@ -21,30 +21,30 @@ public partial class TreeViewGitFileDisplay : ComponentBase, ITreeViewGitFileRen private bool IsChecked { - get => GitState.StagedGitFileMap.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); + get => GitState.StagedFileMap.ContainsKey(TreeViewGitFile.Item.AbsolutePath.Value); set { var localGitState = GitState; - Dispatcher.Dispatch(new GitState.SetGitStateWithAction(inState => + Dispatcher.Dispatch(new GitState.WithAction(inState => { - if (inState.GitFolderAbsolutePath != localGitState.GitFolderAbsolutePath) + if (inState.Repo != localGitState.Repo) { // Git folder was changed, throw away the result since it is thereby invalid. return inState; } var key = TreeViewGitFile.Item.AbsolutePath.Value; - ImmutableDictionary outStagedGitFileMap; + ImmutableDictionary outStagedFileMap; - if (inState.StagedGitFileMap.ContainsKey(key)) - outStagedGitFileMap = inState.StagedGitFileMap.Remove(key); + if (inState.StagedFileMap.ContainsKey(key)) + outStagedFileMap = inState.StagedFileMap.Remove(key); else - outStagedGitFileMap = inState.StagedGitFileMap.Add(key, TreeViewGitFile.Item); + outStagedFileMap = inState.StagedFileMap.Add(key, TreeViewGitFile.Item); return inState with { - StagedGitFileMap = outStagedGitFileMap + StagedFileMap = outStagedFileMap }; })); } diff --git a/Source/Tests/Ide/Basis/Gits/States/GitStateActionsTests.cs b/Source/Tests/Ide/Basis/Gits/States/GitStateActionsTests.cs index b820f4787..4a700cb58 100644 --- a/Source/Tests/Ide/Basis/Gits/States/GitStateActionsTests.cs +++ b/Source/Tests/Ide/Basis/Gits/States/GitStateActionsTests.cs @@ -8,7 +8,7 @@ namespace Luthetus.Ide.Tests.Basis.Gits.States; public class GitStateActionsTests { /// - /// + /// /// [Fact] public void SetGitStateWithAction() diff --git a/Source/Tests/Ide/Basis/Gits/States/GitStateReducerTests.cs b/Source/Tests/Ide/Basis/Gits/States/GitStateReducerTests.cs index 9e5200c61..2b5974a48 100644 --- a/Source/Tests/Ide/Basis/Gits/States/GitStateReducerTests.cs +++ b/Source/Tests/Ide/Basis/Gits/States/GitStateReducerTests.cs @@ -8,7 +8,7 @@ namespace Luthetus.Ide.Tests.Basis.Gits.States; public class GitStateReducerTests { /// - /// + /// /// [Fact] public void ReduceSetGitStateWithAction() From d3ae1c854ab83a8132e775b4260d5889941056e6 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sat, 4 May 2024 20:01:09 -0400 Subject: [PATCH 51/56] Should look at the .git folder instead of parsing terminal --- .../Gits/Displays/GitAddRepoDisplay.razor | 25 +++++ .../Gits/Displays/GitAddRepoDisplay.razor.cs | 91 +++++++++++++++++++ .../Gits/Displays/GitControlsDisplay.razor.cs | 8 +- .../Gits/Displays/GitDiffDisplay.razor.cs | 2 +- .../Gits/Displays/GitDisplay.razor | 13 ++- .../Gits/Displays/GitOriginDisplay.razor.cs | 4 +- .../Displays/GitPickGitFolderDisplay.razor | 35 +++---- .../Displays/GitPickGitFolderDisplay.razor.cs | 61 ++++--------- .../Ide/Ide.RazorLib/Gits/Models/GitRepo.cs | 5 +- .../Terminals/Models/GitCliOutputParser.cs | 2 +- 10 files changed, 161 insertions(+), 85 deletions(-) create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor create mode 100644 Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor.cs diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor new file mode 100644 index 000000000..260ea25d0 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor @@ -0,0 +1,25 @@ +
+
+ Repo Folder (absolute path): +
+ +
+ + + + +
+
+ + \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor.cs new file mode 100644 index 000000000..14fc90f15 --- /dev/null +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitAddRepoDisplay.razor.cs @@ -0,0 +1,91 @@ +using Fluxor; +using Luthetus.Common.RazorLib.ComponentRenderers.Models; +using Luthetus.Common.RazorLib.Dialogs.States; +using Luthetus.Common.RazorLib.Dynamics.Models; +using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.Notifications.Models; +using Luthetus.Ide.RazorLib.Gits.Models; +using Luthetus.Ide.RazorLib.Gits.States; +using Luthetus.Ide.RazorLib.InputFiles.Models; +using Luthetus.Ide.RazorLib.InputFiles.States; +using Microsoft.AspNetCore.Components; +using System.Collections.Immutable; + +namespace Luthetus.Ide.RazorLib.Gits.Displays; + +public partial class GitAddRepoDisplay : ComponentBase +{ + [Inject] + private InputFileSync InputFileSync { get; set; } = null!; + [Inject] + private IDispatcher Dispatcher { get; set; } = null!; + [Inject] + private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; + [Inject] + private ILuthetusCommonComponentRenderers CommonComponentRenderers { get; set; } = null!; + + [CascadingParameter] + public IDialog Dialog { get; set; } = null!; + + private string _repoAbsolutePathString = string.Empty; + + /// + /// This method allows for a user to pick the '.git' folder, OR a directory.

+ /// + /// Case '.git' is picked:
+ /// The repo will be the parent directory of the '.git' folder.

+ /// + /// Case a directory is picked:
+ /// If directory contains a '.git' folder, then begin using the CLI to get data about the repo.
+ /// Else if directory does NOT contain a '.git' folder, then promp the user to run 'git init'. + ///
+ private void RequestInputFileForGitFolder() + { + InputFileSync.RequestInputFileStateForm("Git Repo", + async absolutePath => + { + if (absolutePath is null) + return; + + if (absolutePath.NameNoExtension == ".git") + { + if (absolutePath.ParentDirectory is null) + { + NotificationHelper.DispatchError( + $"ERROR: {nameof(RequestInputFileForGitFolder)}", + "'.git' folder did not have a parent directory.", + CommonComponentRenderers, + Dispatcher, + TimeSpan.FromSeconds(10)); + return; + } + + absolutePath = EnvironmentProvider.AbsolutePathFactory( + absolutePath.ParentDirectory.Value, + true); + } + + _repoAbsolutePathString = absolutePath.Value; + await InvokeAsync(StateHasChanged); + }, + absolutePath => + { + if (absolutePath is null || !absolutePath.IsDirectory) + return Task.FromResult(false); + + return Task.FromResult(true); + }, + new[] + { + new InputFilePattern("Directory", absolutePath => absolutePath.IsDirectory) + }.ToImmutableArray()); + } + + private void ConfirmGitFolderOnClick() + { + var repoAbsolutePath = EnvironmentProvider.AbsolutePathFactory(_repoAbsolutePathString, true); + Dispatcher.Dispatch(new GitState.SetRepoAction(new GitRepo(repoAbsolutePath))); + + Dispatcher.Dispatch(new DialogState.DisposeAction(Dialog.DynamicViewModelKey)); + } +} \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs index fccb8388c..2ca61102d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitControlsDisplay.razor.cs @@ -53,7 +53,7 @@ private async Task ExecuteGitStatusTerminalCommandOnClick() var gitStatusCommand = new TerminalCommand( GitStatusTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value, + localGitState.Repo.AbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -74,7 +74,7 @@ private async Task SubmitOnClick(GitState localGitState) foreach (var fileAbsolutePath in localGitState.StagedFileMap.Values) { var relativePathString = PathHelper.GetRelativeFromTwoAbsolutes( - localGitState.Repo.RepoFolderAbsolutePath, + localGitState.Repo.AbsolutePath, fileAbsolutePath.AbsolutePath, EnvironmentProvider); @@ -105,7 +105,7 @@ private async Task SubmitOnClick(GitState localGitState) var gitAddCommand = new TerminalCommand( GitStatusTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value, + localGitState.Repo.AbsolutePath.Value, ContinueWith: () => CommitChanges(localGitState, localSummary)); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -129,7 +129,7 @@ private async Task CommitChanges(GitState localGitState, string localSummary) var gitCommitCommand = new TerminalCommand( GitCommitTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value, + localGitState.Repo.AbsolutePath.Value, ContinueWith: ExecuteGitStatusTerminalCommandOnClick); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs index df77f419c..04e7aa9de 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDiffDisplay.razor.cs @@ -45,7 +45,7 @@ private async Task ShowOriginalFromGitOnClick() var gitStatusCommand = new TerminalCommand( GitLogTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value); + localGitState.Repo.AbsolutePath.Value); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; await generalTerminal.EnqueueCommandAsync(gitStatusCommand); diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor index 139a3d473..1ed266da0 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitDisplay.razor @@ -10,19 +10,18 @@ @{ var localGitState = GitStateWrap.Value; }
- Git Changes + Git
- @if (localGitState.Repo is null) - { - - } - else + + + + @if (localGitState.Repo is not null) {
- @localGitState.Repo.RepoFolderAbsolutePath.NameNoExtension + @localGitState.Repo.AbsolutePath.NameNoExtension
diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs index e2e701c37..d2fea07ac 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitOriginDisplay.razor.cs @@ -50,7 +50,7 @@ private async Task GetOriginOnClick() var gitStatusCommand = new TerminalCommand( GitSetOriginTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value, + localGitState.Repo.AbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; @@ -79,7 +79,7 @@ private async Task SetGitOriginOnClick(string localCommandArgs) var gitStatusCommand = new TerminalCommand( GitSetOriginTerminalCommandKey, formattedCommand, - localGitState.Repo.RepoFolderAbsolutePath.Value, + localGitState.Repo.AbsolutePath.Value, OutputParser: gitCliOutputParser); var generalTerminal = TerminalStateWrap.Value.TerminalMap[TerminalFacts.GENERAL_TERMINAL_KEY]; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor index ef4310130..e47f6ccfe 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor @@ -1,27 +1,14 @@
-
-
- Git Folder (absolute path): -
-
- - - - -
- - -
+ + +
\ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index cc9a9e260..3ca332b54 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -1,63 +1,34 @@ using Fluxor; +using Luthetus.Common.RazorLib.Dialogs.Models; +using Luthetus.Common.RazorLib.Dialogs.States; +using Luthetus.Common.RazorLib.Dynamics.Models; using Luthetus.Common.RazorLib.FileSystems.Models; +using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.InputFiles.Models; using Luthetus.Ide.RazorLib.InputFiles.States; using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Gits.Displays; public partial class GitPickGitFolderDisplay : ComponentBase { - [Inject] - private InputFileSync InputFileSync { get; set; } = null!; [Inject] private IDispatcher Dispatcher { get; set; } = null!; - [Inject] - private IEnvironmentProvider EnvironmentProvider { get; set; } = null!; - - private string _gitFolderAbsolutePath = string.Empty; - - private void RequestInputFileForGitFolder() + + private void ShowAddRepoDialogOnClick() { - InputFileSync.RequestInputFileStateForm("Git Folder", - async absolutePath => - { - if (absolutePath is null) - return; - - _gitFolderAbsolutePath = absolutePath.Value; - await InvokeAsync(StateHasChanged); - }, - absolutePath => - { - if (absolutePath is null || - !absolutePath.IsDirectory || - absolutePath.NameNoExtension != ".git") - { - return Task.FromResult(false); - } - - return Task.FromResult(true); - }, - new[] - { - new InputFilePattern("Directory", absolutePath => absolutePath.IsDirectory) - }.ToImmutableArray()); - } - - private void ConfirmGitFolderOnClick() - { - var gitFolder = EnvironmentProvider.AbsolutePathFactory(_gitFolderAbsolutePath, true); - - if (gitFolder.ParentDirectory is null) - return; - - var workingDirectory = EnvironmentProvider.AbsolutePathFactory(gitFolder.ParentDirectory.Value, true); - - Dispatcher.Dispatch(new GitState.SetRepoAction( - new GitRepo(workingDirectory, gitFolder))); + var dialogViewModel = new DialogViewModel( + Key.NewKey(), + $"Git Origin", + typeof(GitAddRepoDisplay), + null, + null, + true); + + Dispatcher.Dispatch(new DialogState.RegisterAction(dialogViewModel)); } } \ No newline at end of file diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs index 96cb453e3..cdfe2f40b 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitRepo.cs @@ -2,4 +2,7 @@ namespace Luthetus.Ide.RazorLib.Gits.Models; -public record GitRepo(IAbsolutePath RepoFolderAbsolutePath, IAbsolutePath GitFolderAbsolutePath); +/// +/// TODO: Why am I parsing the CLI output? Can I just look at the '.git' folder itself? (2024-05-04) +/// +public record GitRepo(IAbsolutePath AbsolutePath); diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs index c3b4d6a1c..2aa103e0d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/GitCliOutputParser.cs @@ -129,7 +129,7 @@ public List ParseLine(string output) var relativePathString = textSpan.GetText(); var absolutePathString = PathHelper.GetAbsoluteFromAbsoluteAndRelative( - _gitState.Repo.RepoFolderAbsolutePath, + _gitState.Repo.AbsolutePath, relativePathString, _environmentProvider); From 89b7c0a6deb6e4d938377cbec34bcad63a0f10f0 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 5 May 2024 15:48:19 -0400 Subject: [PATCH 52/56] Updating C# projects --- Luthetus.Ide.sln | 7 ------- .../Lib/Common/Luthetus.Common.RazorLib.csproj | 16 +++++++++------- .../Luthetus.CompilerServices.Lang.CSharp.csproj | 4 ---- .../Luthetus.TextEditor.RazorLib.csproj | 7 ------- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Luthetus.Ide.sln b/Luthetus.Ide.sln index 3f025484e..751a79c4c 100644 --- a/Luthetus.Ide.sln +++ b/Luthetus.Ide.sln @@ -41,8 +41,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.L EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Razor", "Source\Lib\CompilerServices\Razor\Luthetus.CompilerServices.Lang.Razor.csproj", "{943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Terminal", "Source\Lib\CompilerServices\Terminal\Luthetus.CompilerServices.Lang.Terminal.csproj", "{76F4AB6D-5249-4D0A-AAF8-D656E792AA34}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.TypeScript", "Source\Lib\CompilerServices\TypeScript\Luthetus.CompilerServices.Lang.TypeScript.csproj", "{FA133D31-0DCC-4737-A76F-8AF6D8755EDE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Luthetus.CompilerServices.Lang.Xml", "Source\Lib\CompilerServices\Xml\Luthetus.CompilerServices.Lang.Xml.csproj", "{83C1B854-C3AD-4C1E-B2BC-799642039C3D}" @@ -145,10 +143,6 @@ Global {943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Debug|Any CPU.Build.0 = Debug|Any CPU {943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Release|Any CPU.ActiveCfg = Release|Any CPU {943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49}.Release|Any CPU.Build.0 = Release|Any CPU - {76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76F4AB6D-5249-4D0A-AAF8-D656E792AA34}.Release|Any CPU.Build.0 = Release|Any CPU {FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA133D31-0DCC-4737-A76F-8AF6D8755EDE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -257,7 +251,6 @@ Global {F297E0E8-3582-41BE-AB48-14D89413B7E0} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} {7348E3F2-3749-4D5F-AEA5-21C7D19FCC49} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} {943CF0EB-80DF-4D2F-BF23-0EF6A5B2DA49} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} - {76F4AB6D-5249-4D0A-AAF8-D656E792AA34} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} {FA133D31-0DCC-4737-A76F-8AF6D8755EDE} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} {83C1B854-C3AD-4C1E-B2BC-799642039C3D} = {195D2EF7-3938-4BF8-B483-170AD8FF5B84} {4BC736B4-4A2D-43C7-AD2D-7B24F5E35518} = {ACC32A2F-DF9C-4B91-80AE-F0585CDD59EC} diff --git a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj index 655a736f2..345075353 100644 --- a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj +++ b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj @@ -17,13 +17,15 @@ - - - - - - - + + + + + + + + + diff --git a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj index fe6e9154f..8f1abd557 100644 --- a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj +++ b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj @@ -13,10 +13,6 @@ DotNet CSharp Blazor RazorComponents - - - - diff --git a/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj b/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj index bbcc19435..0506d3258 100644 --- a/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj +++ b/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj @@ -17,13 +17,6 @@ - - - - - - - From 0b05f980af701edbbbccae69c596445b33ced746 Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 5 May 2024 15:48:55 -0400 Subject: [PATCH 53/56] Refactor: remove unnecessary usings in solution --- .../Common/BackgroundTasks/Models/BackgroundTaskWorker.cs | 1 - .../Contexts/Displays/ContextBoundaryMeasurer.razor.cs | 1 - Source/Lib/Common/Tabs/Displays/TabDisplay.razor.cs | 1 - .../Css/Css/SyntaxActors/CssSyntaxTree.cs | 1 - .../Displays/CSharpProjectFormDisplay.razor.cs | 1 - Source/Lib/Ide/Ide.RazorLib/Commands/CommandFactory.cs | 1 - .../DotNetSolutions/States/DotNetSolutionSync.Tasks.cs | 1 - Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs | 1 - .../Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs | 1 - .../Gits/Displays/GitChangesContextMenu.razor.cs | 4 ---- .../Gits/Displays/GitPickGitFolderDisplay.razor.cs | 7 ------- .../Gits/Models/GitTreeViewMouseEventHandler.cs | 1 - Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs | 1 - .../Displays/TestExplorerDetailsDisplay.razor.cs | 1 - .../Website.RazorLib/LuthetusWebsiteInitializer.razor.cs | 1 - .../Models/Defaults/TextEditorCommandDefaultFacts.cs | 1 - .../Models/Defaults/TextEditorCommandDefaultFunctions.cs | 2 -- .../Displays/TextEditorViewModelDisplay.razor.cs | 1 - .../Ide/Basis/Gits/States/GitSyncConstructorTests.cs | 8 +------- .../Tests/Ide/Basis/Gits/States/GitSyncEnqueuesTests.cs | 5 +---- Source/Tests/Ide/Basis/Terminals/Models/TerminalTests.cs | 1 - .../TreeViewCSharpProjectNugetPackageReferenceTests.cs | 2 -- .../TreeViewCSharpProjectToProjectReferenceTests.cs | 1 - .../Models/TreeViewCompilerServiceTests.cs | 2 -- .../Models/TreeViewGitFileTests.cs | 4 +--- .../Models/TreeViewMarkupStringTests.cs | 1 - .../Models/TreeViewNamespacePathTests.cs | 1 - .../Models/TreeViewProjectTestModelTests.cs | 1 - .../Models/TreeViewReflectionWithViewTests.cs | 3 --- .../Models/TreeViewSolutionFolderTests.cs | 2 -- .../Models/TreeViewSpinnerTests.cs | 1 - .../TextEditor/Basis/Events/BatchScrollEventsTests.cs | 4 +--- .../Basis/TextEditors/Models/RenderBatchTests.cs | 4 +--- .../TextEditors/Models/TextEditorViewModelApiTests.cs | 1 - 34 files changed, 5 insertions(+), 64 deletions(-) diff --git a/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs b/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs index f5235bcbc..879ba79ca 100644 --- a/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs +++ b/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs @@ -1,5 +1,4 @@ using Luthetus.Common.RazorLib.Keys.Models; -using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace Luthetus.Common.RazorLib.BackgroundTasks.Models; diff --git a/Source/Lib/Common/Contexts/Displays/ContextBoundaryMeasurer.razor.cs b/Source/Lib/Common/Contexts/Displays/ContextBoundaryMeasurer.razor.cs index a140c8e90..d8bbfd77d 100644 --- a/Source/Lib/Common/Contexts/Displays/ContextBoundaryMeasurer.razor.cs +++ b/Source/Lib/Common/Contexts/Displays/ContextBoundaryMeasurer.razor.cs @@ -3,7 +3,6 @@ using Fluxor; using Microsoft.JSInterop; using System.Collections.Immutable; -using Luthetus.Common.RazorLib.JavaScriptObjects.Models; using Luthetus.Common.RazorLib.Contexts.States; using Luthetus.Common.RazorLib.Contexts.Models; using Luthetus.Common.RazorLib.Keys.Models; diff --git a/Source/Lib/Common/Tabs/Displays/TabDisplay.razor.cs b/Source/Lib/Common/Tabs/Displays/TabDisplay.razor.cs index 91f84118c..f422cc56e 100644 --- a/Source/Lib/Common/Tabs/Displays/TabDisplay.razor.cs +++ b/Source/Lib/Common/Tabs/Displays/TabDisplay.razor.cs @@ -2,7 +2,6 @@ using Luthetus.Common.RazorLib.Dimensions.Models; using Luthetus.Common.RazorLib.Drags.Displays; using Luthetus.Common.RazorLib.Resizes.Models; -using Luthetus.Common.RazorLib.JavaScriptObjects.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.JSInterop; diff --git a/Source/Lib/CompilerServices/Css/Css/SyntaxActors/CssSyntaxTree.cs b/Source/Lib/CompilerServices/Css/Css/SyntaxActors/CssSyntaxTree.cs index c1b4df1e1..9d7275000 100644 --- a/Source/Lib/CompilerServices/Css/Css/SyntaxActors/CssSyntaxTree.cs +++ b/Source/Lib/CompilerServices/Css/Css/SyntaxActors/CssSyntaxTree.cs @@ -7,7 +7,6 @@ using Luthetus.TextEditor.RazorLib.CompilerServices; using Luthetus.TextEditor.RazorLib.CompilerServices.Utility; using Luthetus.TextEditor.RazorLib.CompilerServices.Facts; -using Luthetus.Common.RazorLib.Exceptions; using Luthetus.TextEditor.RazorLib.Exceptions; namespace Luthetus.CompilerServices.Lang.Css.Css.SyntaxActors; diff --git a/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs index df6a7cca3..e4f6391d5 100644 --- a/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/CSharpProjectForms/Displays/CSharpProjectFormDisplay.razor.cs @@ -20,7 +20,6 @@ using Luthetus.Ide.RazorLib.Websites; using Luthetus.Common.RazorLib.Dynamics.Models; using Luthetus.TextEditor.RazorLib; -using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; namespace Luthetus.Ide.RazorLib.CSharpProjectForms.Displays; diff --git a/Source/Lib/Ide/Ide.RazorLib/Commands/CommandFactory.cs b/Source/Lib/Ide/Ide.RazorLib/Commands/CommandFactory.cs index 44c413e77..a5498711d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Commands/CommandFactory.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Commands/CommandFactory.cs @@ -17,7 +17,6 @@ using Luthetus.Ide.RazorLib.CodeSearches.Displays; using Luthetus.Common.RazorLib.Dynamics.Models; using Luthetus.TextEditor.RazorLib; -using Luthetus.TextEditor.RazorLib.JsRuntimes; using Luthetus.Common.RazorLib.JsRuntimes.Models; namespace Luthetus.Ide.RazorLib.Commands; diff --git a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs index 52d28b403..68e55f219 100644 --- a/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs +++ b/Source/Lib/Ide/Ide.RazorLib/DotNetSolutions/States/DotNetSolutionSync.Tasks.cs @@ -16,7 +16,6 @@ using static Luthetus.Ide.RazorLib.DotNetSolutions.States.DotNetSolutionState; using Luthetus.Ide.RazorLib.CommandLines.Models; using Luthetus.Ide.RazorLib.Terminals.Models; -using Luthetus.Common.RazorLib.Notifications.Models; namespace Luthetus.Ide.RazorLib.DotNetSolutions.States; diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs index 7e29c4270..faef7861d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutput.cs @@ -6,7 +6,6 @@ using Luthetus.TextEditor.RazorLib.Lexes.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -using System.Collections.Generic; namespace Luthetus.Ide.RazorLib.Events.Models; diff --git a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs index bc0aa201f..352f23ed5 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Events/Models/OnOutputBatch.cs @@ -5,7 +5,6 @@ using Luthetus.TextEditor.RazorLib; using Luthetus.TextEditor.RazorLib.TextEditors.Displays; using Luthetus.TextEditor.RazorLib.TextEditors.Models; -using System; namespace Luthetus.Ide.RazorLib.Events.Models; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs index 7dbc25c99..7f382fd64 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitChangesContextMenu.razor.cs @@ -7,11 +7,7 @@ using Luthetus.Common.RazorLib.Dropdowns.Models; using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Common.RazorLib.Dimensions.Models; -using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; -using Luthetus.Ide.RazorLib.CommandLines.Models; -using Luthetus.Ide.RazorLib.Terminals.Models; using Luthetus.Common.RazorLib.BackgroundTasks.Models; -using System.Text; using Luthetus.Ide.RazorLib.Gits.States; namespace Luthetus.Ide.RazorLib.Gits.Displays; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs index 3ca332b54..89aadccdd 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Displays/GitPickGitFolderDisplay.razor.cs @@ -2,15 +2,8 @@ using Luthetus.Common.RazorLib.Dialogs.Models; using Luthetus.Common.RazorLib.Dialogs.States; using Luthetus.Common.RazorLib.Dynamics.Models; -using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Common.RazorLib.Keys.Models; -using Luthetus.Ide.RazorLib.Gits.Models; -using Luthetus.Ide.RazorLib.Gits.States; -using Luthetus.Ide.RazorLib.InputFiles.Models; -using Luthetus.Ide.RazorLib.InputFiles.States; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; -using System.Collections.Immutable; namespace Luthetus.Ide.RazorLib.Gits.Displays; diff --git a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs index 95afb1657..e8145b230 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Gits/Models/GitTreeViewMouseEventHandler.cs @@ -9,7 +9,6 @@ using Luthetus.Ide.RazorLib.Gits.Displays; using Luthetus.Ide.RazorLib.Gits.States; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; -using System.Reactive; namespace Luthetus.Ide.RazorLib.Gits.Models; diff --git a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs index e6c268cce..244ad857e 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs +++ b/Source/Lib/Ide/Ide.RazorLib/Terminals/Models/Terminal.cs @@ -10,7 +10,6 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; using Luthetus.TextEditor.RazorLib.CompilerServices.Interfaces; using Luthetus.TextEditor.RazorLib.Commands.Models.Defaults; -using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Symbols; using Luthetus.TextEditor.RazorLib; using Luthetus.Ide.RazorLib.Terminals.States; using CliWrap; diff --git a/Source/Lib/Ide/Ide.RazorLib/TestExplorers/Displays/TestExplorerDetailsDisplay.razor.cs b/Source/Lib/Ide/Ide.RazorLib/TestExplorers/Displays/TestExplorerDetailsDisplay.razor.cs index 92c7b2b17..dbfa12c9d 100644 --- a/Source/Lib/Ide/Ide.RazorLib/TestExplorers/Displays/TestExplorerDetailsDisplay.razor.cs +++ b/Source/Lib/Ide/Ide.RazorLib/TestExplorers/Displays/TestExplorerDetailsDisplay.razor.cs @@ -6,7 +6,6 @@ using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Ide.RazorLib.Terminals.Models; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; -using Luthetus.TextEditor.RazorLib.TextEditors.Displays.Internals; using Luthetus.TextEditor.RazorLib.TextEditors.Models; using Luthetus.Common.RazorLib.TreeViews.Models; diff --git a/Source/Lib/Ide/Website.RazorLib/LuthetusWebsiteInitializer.razor.cs b/Source/Lib/Ide/Website.RazorLib/LuthetusWebsiteInitializer.razor.cs index e6be118f3..bccd4e294 100644 --- a/Source/Lib/Ide/Website.RazorLib/LuthetusWebsiteInitializer.razor.cs +++ b/Source/Lib/Ide/Website.RazorLib/LuthetusWebsiteInitializer.razor.cs @@ -17,7 +17,6 @@ using Luthetus.TextEditor.RazorLib.CompilerServices.Facts; using Luthetus.Common.RazorLib.Installations.Models; using Luthetus.TextEditor.RazorLib; -using Luthetus.TextEditor.RazorLib.TextEditors.Models; namespace Luthetus.Website.RazorLib; diff --git a/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFacts.cs b/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFacts.cs index 477e0d4b2..a2509e03a 100644 --- a/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFacts.cs +++ b/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFacts.cs @@ -1,6 +1,5 @@ using Luthetus.Common.RazorLib.JsRuntimes.Models; using Luthetus.TextEditor.RazorLib.Edits.Models; -using Microsoft.JSInterop; namespace Luthetus.TextEditor.RazorLib.Commands.Models.Defaults; diff --git a/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFunctions.cs b/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFunctions.cs index 230563e87..8e495c2e1 100644 --- a/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFunctions.cs +++ b/Source/Lib/TextEditor/Commands/Models/Defaults/TextEditorCommandDefaultFunctions.cs @@ -5,8 +5,6 @@ using Microsoft.AspNetCore.Components.Web; using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Common.RazorLib.RenderStates.Models; -using Luthetus.Common.RazorLib.JavaScriptObjects.Models; -using Microsoft.JSInterop; using Luthetus.TextEditor.RazorLib.Characters.Models; using Luthetus.TextEditor.RazorLib.TextEditors.Models.TextEditorServices; using Luthetus.TextEditor.RazorLib.Lexes.Models; diff --git a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs index 8489d7d67..cfe37a630 100644 --- a/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs +++ b/Source/Lib/TextEditor/TextEditors/Displays/TextEditorViewModelDisplay.razor.cs @@ -24,7 +24,6 @@ using Luthetus.TextEditor.RazorLib.TextEditors.Models.TextEditorServices; using Luthetus.TextEditor.RazorLib.TextEditors.Models.TextEditorModels; using Luthetus.TextEditor.RazorLib.Keymaps.Models.Defaults; -using Luthetus.TextEditor.RazorLib.Events; using Luthetus.TextEditor.RazorLib.Exceptions; using Luthetus.TextEditor.RazorLib.JsRuntimes.Models; using Luthetus.TextEditor.RazorLib.Events.Models; diff --git a/Source/Tests/Ide/Basis/Gits/States/GitSyncConstructorTests.cs b/Source/Tests/Ide/Basis/Gits/States/GitSyncConstructorTests.cs index c29793585..135031a6d 100644 --- a/Source/Tests/Ide/Basis/Gits/States/GitSyncConstructorTests.cs +++ b/Source/Tests/Ide/Basis/Gits/States/GitSyncConstructorTests.cs @@ -1,10 +1,4 @@ -using Fluxor; -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Common.RazorLib.BackgroundTasks.Models; -using Luthetus.Ide.RazorLib.Gits.States; -using Luthetus.Ide.RazorLib.Terminals.States; - -namespace Luthetus.Ide.Tests.Basis.Gits.States; +namespace Luthetus.Ide.Tests.Basis.Gits.States; /// /// diff --git a/Source/Tests/Ide/Basis/Gits/States/GitSyncEnqueuesTests.cs b/Source/Tests/Ide/Basis/Gits/States/GitSyncEnqueuesTests.cs index 6992b5f72..46d77f34c 100644 --- a/Source/Tests/Ide/Basis/Gits/States/GitSyncEnqueuesTests.cs +++ b/Source/Tests/Ide/Basis/Gits/States/GitSyncEnqueuesTests.cs @@ -1,7 +1,4 @@ -using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Ide.RazorLib.Gits.States; - -namespace Luthetus.Ide.Tests.Basis.Gits.States; +namespace Luthetus.Ide.Tests.Basis.Gits.States; /// /// diff --git a/Source/Tests/Ide/Basis/Terminals/Models/TerminalTests.cs b/Source/Tests/Ide/Basis/Terminals/Models/TerminalTests.cs index 3199c806f..85b597df8 100644 --- a/Source/Tests/Ide/Basis/Terminals/Models/TerminalTests.cs +++ b/Source/Tests/Ide/Basis/Terminals/Models/TerminalTests.cs @@ -1,4 +1,3 @@ -using Luthetus.Common.RazorLib.Keys.Models; using Luthetus.Common.RazorLib.BackgroundTasks.Models; using Luthetus.Common.RazorLib.ComponentRenderers.Models; using Luthetus.TextEditor.RazorLib; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs index eac1e8958..25db85242 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs @@ -4,8 +4,6 @@ using Luthetus.Ide.RazorLib.Nugets.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Common.RazorLib.ComponentRenderers.Models; -using Luthetus.Common.RazorLib.Namespaces.Models; -using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project; using Microsoft.Extensions.DependencyInjection; namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs index a4bb662ad..076eabb78 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs @@ -4,7 +4,6 @@ using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Common.RazorLib.ComponentRenderers.Models; -using Luthetus.Ide.RazorLib.Gits.Models; using Microsoft.Extensions.DependencyInjection; using Luthetus.Common.RazorLib.Namespaces.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs index 0bf0731f4..dfd364698 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs @@ -3,8 +3,6 @@ using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Common.RazorLib.Namespaces.Models; -using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project; using Microsoft.Extensions.DependencyInjection; using Luthetus.CompilerServices.Lang.CSharp.CompilerServiceCase; using Luthetus.TextEditor.RazorLib; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs index 8024403b6..e0f772442 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs @@ -1,10 +1,8 @@ -using Luthetus.Common.RazorLib.TreeViews.Models; -using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; +using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Ide.RazorLib.Gits.Models; using Luthetus.Common.RazorLib.ComponentRenderers.Models; using Luthetus.Common.RazorLib.FileSystems.Models; -using Microsoft.AspNetCore.Components; using Microsoft.Extensions.DependencyInjection; namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs index 63957c9c5..de39a7bec 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs @@ -4,7 +4,6 @@ using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Common.RazorLib.ComponentRenderers.Models; -using Luthetus.Common.RazorLib.Namespaces.Models; using Microsoft.Extensions.DependencyInjection; namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs index d79b0d781..e8da70604 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs @@ -4,7 +4,6 @@ using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; -using Luthetus.Ide.RazorLib.TestExplorers.Models; using Microsoft.Extensions.DependencyInjection; namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs index a10814985..9806bdd07 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs @@ -3,7 +3,6 @@ using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.TestExplorers.Models; using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.Common.RazorLib.WatchWindows.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Microsoft.Extensions.DependencyInjection; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs index 7ed6df5bc..e2030206a 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs @@ -3,9 +3,6 @@ using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; using Luthetus.Common.RazorLib.FileSystems.Models; -using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project; -using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Tokens; -using Luthetus.TextEditor.RazorLib.Lexes.Models; using Microsoft.Extensions.DependencyInjection; namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs index ba3795b89..b4e8dfa1a 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs @@ -4,8 +4,6 @@ using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; -using Luthetus.CompilerServices.Lang.DotNetSolution.Models; -using System.Collections.Immutable; using Microsoft.Extensions.DependencyInjection; using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Tokens; using Luthetus.TextEditor.RazorLib.Lexes.Models; diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs index aa9aca437..b729e308f 100644 --- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs +++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs @@ -2,7 +2,6 @@ using Luthetus.Common.RazorLib.FileSystems.Models; using Luthetus.Common.RazorLib.TreeViews.Models; using Luthetus.Ide.RazorLib.ComponentRenderers.Models; -using Luthetus.Ide.RazorLib.TestExplorers.Models; using Luthetus.Ide.RazorLib.TreeViewImplementations.Models; using Microsoft.Extensions.DependencyInjection; diff --git a/Source/Tests/TextEditor/Basis/Events/BatchScrollEventsTests.cs b/Source/Tests/TextEditor/Basis/Events/BatchScrollEventsTests.cs index 45423d950..1bd594811 100644 --- a/Source/Tests/TextEditor/Basis/Events/BatchScrollEventsTests.cs +++ b/Source/Tests/TextEditor/Basis/Events/BatchScrollEventsTests.cs @@ -1,6 +1,4 @@ -using Luthetus.TextEditor.RazorLib.Events; - -namespace Luthetus.TextEditor.Tests.Basis.Events; +namespace Luthetus.TextEditor.Tests.Basis.Events; /// /// diff --git a/Source/Tests/TextEditor/Basis/TextEditors/Models/RenderBatchTests.cs b/Source/Tests/TextEditor/Basis/TextEditors/Models/RenderBatchTests.cs index dff28fd2c..546937350 100644 --- a/Source/Tests/TextEditor/Basis/TextEditors/Models/RenderBatchTests.cs +++ b/Source/Tests/TextEditor/Basis/TextEditors/Models/RenderBatchTests.cs @@ -1,6 +1,4 @@ -using Luthetus.TextEditor.RazorLib.TextEditors.Models.Internals; - -namespace Luthetus.TextEditor.Tests.Basis.TextEditors.Models; +namespace Luthetus.TextEditor.Tests.Basis.TextEditors.Models; /// /// diff --git a/Source/Tests/TextEditor/Basis/TextEditors/Models/TextEditorViewModelApiTests.cs b/Source/Tests/TextEditor/Basis/TextEditors/Models/TextEditorViewModelApiTests.cs index 8a570437f..46ff3848a 100644 --- a/Source/Tests/TextEditor/Basis/TextEditors/Models/TextEditorViewModelApiTests.cs +++ b/Source/Tests/TextEditor/Basis/TextEditors/Models/TextEditorViewModelApiTests.cs @@ -13,7 +13,6 @@ using Microsoft.JSInterop; using Microsoft.AspNetCore.Components.Web; using Luthetus.TextEditor.Tests.JsRuntimes; -using static Luthetus.TextEditor.RazorLib.TextEditors.Models.TextEditorModelModifier; using Luthetus.Common.RazorLib.Keyboards.Models; namespace Luthetus.TextEditor.Tests.Basis.TextEditors.Models; From cca4b5337f5f6ba6a5ae3fa7258e508573f6c5ad Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 5 May 2024 16:02:33 -0400 Subject: [PATCH 54/56] Fix build errors --- .../Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs | 1 + Source/Lib/Common/Luthetus.Common.RazorLib.csproj | 4 +++- .../CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj | 4 ++++ Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj | 2 -- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs b/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs index 879ba79ca..f5235bcbc 100644 --- a/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs +++ b/Source/Lib/Common/BackgroundTasks/Models/BackgroundTaskWorker.cs @@ -1,4 +1,5 @@ using Luthetus.Common.RazorLib.Keys.Models; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace Luthetus.Common.RazorLib.BackgroundTasks.Models; diff --git a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj index 345075353..2a01b2d00 100644 --- a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj +++ b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj @@ -1,4 +1,4 @@ - + net6.0 @@ -25,6 +25,8 @@ + + diff --git a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj index 8f1abd557..fe6e9154f 100644 --- a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj +++ b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj @@ -13,6 +13,10 @@ DotNet CSharp Blazor RazorComponents + + + + diff --git a/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj b/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj index bb975b4c7..bb1221aa2 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj +++ b/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj @@ -17,8 +17,6 @@ - - From 075aee8d8435f4ea81ef8f4cf56c26413a62b7ec Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 5 May 2024 16:33:26 -0400 Subject: [PATCH 55/56] Update versions --- .../Common/Luthetus.Common.RazorLib.csproj | 2 +- .../C/Luthetus.CompilerServices.Lang.C.csproj | 2 +- ...thetus.CompilerServices.Lang.CSharp.csproj | 2 +- ...CompilerServices.Lang.CSharpProject.csproj | 2 +- .../Luthetus.CompilerServices.Lang.Css.csproj | 2 +- ...ompilerServices.Lang.DotNetSolution.csproj | 2 +- ...thetus.CompilerServices.Lang.FSharp.csproj | 2 +- ...us.CompilerServices.Lang.JavaScript.csproj | 2 +- ...Luthetus.CompilerServices.Lang.Json.csproj | 2 +- ...uthetus.CompilerServices.Lang.Razor.csproj | 2 +- ...us.CompilerServices.Lang.TypeScript.csproj | 2 +- .../Luthetus.CompilerServices.Lang.Xml.csproj | 2 +- .../Ide.RazorLib/Luthetus.Ide.RazorLib.csproj | 4 +- .../Displays/Internals/IdeInfoDisplay.razor | 45 ++++++++++++++++++- .../Luthetus.TextEditor.RazorLib.csproj | 2 +- 15 files changed, 58 insertions(+), 17 deletions(-) diff --git a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj index 2a01b2d00..1629a25cf 100644 --- a/Source/Lib/Common/Luthetus.Common.RazorLib.csproj +++ b/Source/Lib/Common/Luthetus.Common.RazorLib.csproj @@ -7,7 +7,7 @@ Luthetus Common A repository containing Blazor Components I've made which I commonly use in other projects. Luthetus.Common - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/C/Luthetus.CompilerServices.Lang.C.csproj b/Source/Lib/CompilerServices/C/Luthetus.CompilerServices.Lang.C.csproj index fd22b41fb..2a32439dd 100644 --- a/Source/Lib/CompilerServices/C/Luthetus.CompilerServices.Lang.C.csproj +++ b/Source/Lib/CompilerServices/C/Luthetus.CompilerServices.Lang.C.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service C A C implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.C - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj index fe6e9154f..1a45b9d13 100644 --- a/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj +++ b/Source/Lib/CompilerServices/CSharp/Luthetus.CompilerServices.Lang.CSharp.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service C# A C# implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.CSharp - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/CSharpProject/Luthetus.CompilerServices.Lang.CSharpProject.csproj b/Source/Lib/CompilerServices/CSharpProject/Luthetus.CompilerServices.Lang.CSharpProject.csproj index 7cf8dfd83..14685d250 100644 --- a/Source/Lib/CompilerServices/CSharpProject/Luthetus.CompilerServices.Lang.CSharpProject.csproj +++ b/Source/Lib/CompilerServices/CSharpProject/Luthetus.CompilerServices.Lang.CSharpProject.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service C# Project A C# Project implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.CSharpProject - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/Css/Luthetus.CompilerServices.Lang.Css.csproj b/Source/Lib/CompilerServices/Css/Luthetus.CompilerServices.Lang.Css.csproj index d36e7fc5d..d888a32b9 100644 --- a/Source/Lib/CompilerServices/Css/Luthetus.CompilerServices.Lang.Css.csproj +++ b/Source/Lib/CompilerServices/Css/Luthetus.CompilerServices.Lang.Css.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service CSS A CSS implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.Css - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/DotNetSolution/Luthetus.CompilerServices.Lang.DotNetSolution.csproj b/Source/Lib/CompilerServices/DotNetSolution/Luthetus.CompilerServices.Lang.DotNetSolution.csproj index 4129ad3a8..3c86034d1 100644 --- a/Source/Lib/CompilerServices/DotNetSolution/Luthetus.CompilerServices.Lang.DotNetSolution.csproj +++ b/Source/Lib/CompilerServices/DotNetSolution/Luthetus.CompilerServices.Lang.DotNetSolution.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service .NET Solution A .NET Solution implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.DotNetSolution - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/FSharp/Luthetus.CompilerServices.Lang.FSharp.csproj b/Source/Lib/CompilerServices/FSharp/Luthetus.CompilerServices.Lang.FSharp.csproj index 9f71719f4..7973c8466 100644 --- a/Source/Lib/CompilerServices/FSharp/Luthetus.CompilerServices.Lang.FSharp.csproj +++ b/Source/Lib/CompilerServices/FSharp/Luthetus.CompilerServices.Lang.FSharp.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service F# A F# implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.FSharp - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/JavaScript/Luthetus.CompilerServices.Lang.JavaScript.csproj b/Source/Lib/CompilerServices/JavaScript/Luthetus.CompilerServices.Lang.JavaScript.csproj index a682abdc3..7f2d3d5b3 100644 --- a/Source/Lib/CompilerServices/JavaScript/Luthetus.CompilerServices.Lang.JavaScript.csproj +++ b/Source/Lib/CompilerServices/JavaScript/Luthetus.CompilerServices.Lang.JavaScript.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service JavaScript A JavaScript implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.JavaScript - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/Json/Luthetus.CompilerServices.Lang.Json.csproj b/Source/Lib/CompilerServices/Json/Luthetus.CompilerServices.Lang.Json.csproj index 12cfe54e4..71508f0c0 100644 --- a/Source/Lib/CompilerServices/Json/Luthetus.CompilerServices.Lang.Json.csproj +++ b/Source/Lib/CompilerServices/Json/Luthetus.CompilerServices.Lang.Json.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service JSON A JSON implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.Json - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/Razor/Luthetus.CompilerServices.Lang.Razor.csproj b/Source/Lib/CompilerServices/Razor/Luthetus.CompilerServices.Lang.Razor.csproj index 034937d36..b25ab2565 100644 --- a/Source/Lib/CompilerServices/Razor/Luthetus.CompilerServices.Lang.Razor.csproj +++ b/Source/Lib/CompilerServices/Razor/Luthetus.CompilerServices.Lang.Razor.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service Razor A Razor implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.Razor - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/TypeScript/Luthetus.CompilerServices.Lang.TypeScript.csproj b/Source/Lib/CompilerServices/TypeScript/Luthetus.CompilerServices.Lang.TypeScript.csproj index 41bde1ed9..0a128ea13 100644 --- a/Source/Lib/CompilerServices/TypeScript/Luthetus.CompilerServices.Lang.TypeScript.csproj +++ b/Source/Lib/CompilerServices/TypeScript/Luthetus.CompilerServices.Lang.TypeScript.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service TypeScript A TypeScript implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.TypeScript - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/CompilerServices/Xml/Luthetus.CompilerServices.Lang.Xml.csproj b/Source/Lib/CompilerServices/Xml/Luthetus.CompilerServices.Lang.Xml.csproj index 7c02119f0..23b5ba795 100644 --- a/Source/Lib/CompilerServices/Xml/Luthetus.CompilerServices.Lang.Xml.csproj +++ b/Source/Lib/CompilerServices/Xml/Luthetus.CompilerServices.Lang.Xml.csproj @@ -7,7 +7,7 @@ Luthetus Compiler Service HTML/XML An HTML/XML implementation of the ICompilerService interface, which comes from the "Luthetus.TextEditor" repository. Luthetus.CompilerServices.Xml - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents diff --git a/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj b/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj index bb1221aa2..d8b32706e 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj +++ b/Source/Lib/Ide/Ide.RazorLib/Luthetus.Ide.RazorLib.csproj @@ -1,10 +1,10 @@ - + net6.0 enable enable - 0.8.2 + 0.8.3 diff --git a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor index c9a155039..bb68a81bf 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor @@ -19,11 +19,52 @@ Recent Changes:
-
v (WIP_VERSION) (WIP_DATE)
+
v 0.8.3.0 (2024-05-05)
  • - (WIP_DESCRIPTION) + Fix Linux solution explorer paths. (issue was relating to '\' vs '/' directory separator). +
  • +
  • + Fix Linux copy and paste. +
  • +
  • + Fix get local storage. +
  • +
  • + Fix unit test output. (still isn't perfect) +
  • +
  • + Fix insertion of text when text-editor-cursor has a selection +
  • +
  • + Fix text editor mouse wheel scrolling +
  • +
  • + Fix text editor bring cursor into view. +
  • +
  • + Update all NuGet packages (an example: + + Luthetus.TextEditor + + ) +
  • +
  • + Batch terminal output. (this is a massive performance improvement, + instead of writing line by line, if many lines of output need to be written, + they all are written in one operation.) +
  • +
  • + Parse the output of the terminal on a 'by-command-basis'. + One can run 'dotnet run' with a .net cli output parser, + then run 'git status' with a git cli output parser, as an example. +
  • +
  • + Git integration progress. For example, a button that runs "git status", + parses the terminal output, and creates a tree view of all the changed files. + The git integration is still in progress though. (more usage of the '.git' + folder instead of just parsing the terminal so much is likely a path to take).
diff --git a/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj b/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj index 0506d3258..5f6caa0b5 100644 --- a/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj +++ b/Source/Lib/TextEditor/Luthetus.TextEditor.RazorLib.csproj @@ -7,7 +7,7 @@ Luthetus TextEditor A text editor written using Blazor. Contains API for syntax highlighting, and ICompilerService integration. Luthetus.TextEditor - 1.5.0 + 2.0.0 Hunter Freeman DotNet CSharp Blazor RazorComponents From 4bb99b01f10f3e0d89dfe45c57e017e8e21cf26a Mon Sep 17 00:00:00 2001 From: Luthetus <45454132+huntercfreeman@users.noreply.github.com> Date: Sun, 5 May 2024 17:33:44 -0400 Subject: [PATCH 56/56] No time to update the nuget packages today --- .../Shareds/Displays/Internals/IdeInfoDisplay.razor | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor index bb68a81bf..a21ebfd70 100644 --- a/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor +++ b/Source/Lib/Ide/Ide.RazorLib/Shareds/Displays/Internals/IdeInfoDisplay.razor @@ -43,13 +43,6 @@
  • Fix text editor bring cursor into view.
  • -
  • - Update all NuGet packages (an example: - - Luthetus.TextEditor - - ) -
  • Batch terminal output. (this is a massive performance improvement, instead of writing line by line, if many lines of output need to be written,