From a5150edee0bb6b82e2e287317ba085b9b505450b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 29 Apr 2024 17:55:38 +0800 Subject: [PATCH] code_style: rename `platform_finder` to `platformFinder` and run `dotnet format` to apply code style rules --- src/Commands/IsConflictResolved.cs | 2 +- src/Converters/BoolConverters.cs | 2 +- src/Models/ExternalTool.cs | 20 ++++++++++---------- src/ViewModels/Checkout.cs | 8 ++++---- src/ViewModels/Repository.cs | 2 +- src/Views/TextDiffView.axaml.cs | 6 ++++-- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/Commands/IsConflictResolved.cs b/src/Commands/IsConflictResolved.cs index 49bc56fa..6b0182dc 100644 --- a/src/Commands/IsConflictResolved.cs +++ b/src/Commands/IsConflictResolved.cs @@ -2,7 +2,7 @@ { public class IsConflictResolved : Command { - public IsConflictResolved(string repo, Models.Change change) + public IsConflictResolved(string repo, Models.Change change) { var opt = new Models.DiffOption(change, true); diff --git a/src/Converters/BoolConverters.cs b/src/Converters/BoolConverters.cs index 0a7d2aa1..7ddb4637 100644 --- a/src/Converters/BoolConverters.cs +++ b/src/Converters/BoolConverters.cs @@ -8,7 +8,7 @@ namespace SourceGit.Converters public static readonly FuncValueConverter HalfIfFalse = new FuncValueConverter(x => x ? 1 : 0.5); - public static readonly FuncValueConverter BoldIfTrue = + public static readonly FuncValueConverter BoldIfTrue = new FuncValueConverter(x => x ? FontWeight.Bold : FontWeight.Regular); } } diff --git a/src/Models/ExternalTool.cs b/src/Models/ExternalTool.cs index 2b49fae0..c130fbcf 100644 --- a/src/Models/ExternalTool.cs +++ b/src/Models/ExternalTool.cs @@ -116,31 +116,31 @@ namespace SourceGit.Models }); } - public void VSCode(Func platform_finder) + public void VSCode(Func platformFinder) { - TryAdd("Visual Studio Code", "vscode", "\"{0}\"", "VSCODE_PATH", platform_finder); + TryAdd("Visual Studio Code", "vscode", "\"{0}\"", "VSCODE_PATH", platformFinder); } - public void VSCodeInsiders(Func platform_finder) + public void VSCodeInsiders(Func platformFinder) { - TryAdd("Visual Studio Code - Insiders", "vscode_insiders", "\"{0}\"", "VSCODE_INSIDERS_PATH", platform_finder); + TryAdd("Visual Studio Code - Insiders", "vscode_insiders", "\"{0}\"", "VSCODE_INSIDERS_PATH", platformFinder); } - public void Fleet(Func platform_finder) + public void Fleet(Func platformFinder) { - TryAdd("Fleet", "fleet", "\"{0}\"", "FLEET_PATH", platform_finder); + TryAdd("Fleet", "fleet", "\"{0}\"", "FLEET_PATH", platformFinder); } - public void SublimeText(Func platform_finder) + public void SublimeText(Func platformFinder) { - TryAdd("Sublime Text", "sublime_text", "\"{0}\"", "SUBLIME_TEXT_PATH", platform_finder); + TryAdd("Sublime Text", "sublime_text", "\"{0}\"", "SUBLIME_TEXT_PATH", platformFinder); } - public void FindJetBrainsFromToolbox(Func platform_finder) + public void FindJetBrainsFromToolbox(Func platformFinder) { var exclude = new List { "fleet", "dotmemory", "dottrace", "resharper-u", "androidstudio" }; var supported_icons = new List { "CL", "DB", "DL", "DS", "GO", "IC", "IU", "JB", "PC", "PS", "PY", "QA", "QD", "RD", "RM", "RR", "WRS", "WS" }; - var state = Path.Combine(platform_finder(), "state.json"); + var state = Path.Combine(platformFinder(), "state.json"); if (File.Exists(state)) { var stateData = JsonSerializer.Deserialize(File.ReadAllText(state), JsonCodeGen.Default.JetBrainsState); diff --git a/src/ViewModels/Checkout.cs b/src/ViewModels/Checkout.cs index 3ee4b6de..82f97c96 100644 --- a/src/ViewModels/Checkout.cs +++ b/src/ViewModels/Checkout.cs @@ -58,11 +58,11 @@ namespace SourceGit.ViewModels Commands.Discard.All(_repo.FullPath); } } - + SetProgressDescription("Checkout branch ..."); var rs = new Commands.Checkout(_repo.FullPath).Branch(Branch, SetProgressDescription); - - if(needPopStash) + + if (needPopStash) { SetProgressDescription("Re-apply local changes..."); rs = new Commands.Stash(_repo.FullPath).Apply("stash@{0}"); @@ -71,7 +71,7 @@ namespace SourceGit.ViewModels rs = new Commands.Stash(_repo.FullPath).Drop("stash@{0}"); } } - + CallUIThread(() => _repo.SetWatcherEnabled(true)); return rs; }); diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 949323cb..73a500b5 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -853,7 +853,7 @@ namespace SourceGit.ViewModels checkout.Icon = App.CreateMenuIcon("Icons.Check"); checkout.Click += (o, e) => { - CheckoutLocalBranch(branch.Name); + CheckoutLocalBranch(branch.Name); e.Handled = true; }; menu.Items.Add(checkout); diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 3969c1b7..bdb8edc6 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -686,12 +686,14 @@ namespace SourceGit.Views private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e) { - if (!TextArea.IsFocused) Focus(); + if (!TextArea.IsFocused) + Focus(); } private void OnTextViewScrollChanged(object sender, ScrollChangedEventArgs e) { - if (TextArea.IsFocused) SetCurrentValue(SyncScrollOffsetProperty, _scrollViewer.Offset); + if (TextArea.IsFocused) + SetCurrentValue(SyncScrollOffsetProperty, _scrollViewer.Offset); } private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)