From f2cae4498a505c88c15339279205c2c1c4e1782c Mon Sep 17 00:00:00 2001 From: Piotr Karczmarz Date: Thu, 19 Sep 2024 16:00:36 +0200 Subject: [PATCH 1/5] Added GitHub Action for code style checks. --- .github/workflows/code-style.yml | 19 +++++++++++++++++++ src/Cody.sln | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 .github/workflows/code-style.yml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 0000000..0df61d1 --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,19 @@ +name: Code Style Checks + +on: + push: + branches: + - piotr/code-style-checks + pull_request: + branches: + - main + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Check formatting + run: dotnet format ./src/ --verify-no-changes -v:diag + \ No newline at end of file diff --git a/src/Cody.sln b/src/Cody.sln index b2cfe88..2decebb 100644 --- a/src/Cody.sln +++ b/src/Cody.sln @@ -23,6 +23,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject build.cake = build.cake ..\.github\workflows\cake-build.yml = ..\.github\workflows\cake-build.yml + ..\.github\workflows\code-style.yml = ..\.github\workflows\code-style.yml + ..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml + ..\.github\workflows\release-preview.yml = ..\.github\workflows\release-preview.yml EndProjectSection EndProject Global From 0f4aecaed0660b35f9b13c9a906caea85998c0a9 Mon Sep 17 00:00:00 2001 From: Piotr Karczmarz Date: Thu, 19 Sep 2024 16:06:29 +0200 Subject: [PATCH 2/5] Style changes after running "dotnet format -v:diag" --- src/Cody.AgentTester/AssemblyLoader.cs | 4 ++-- src/Cody.AgentTester/ConsoleLogger.cs | 4 ++-- src/Cody.AgentTester/Properties/AssemblyInfo.cs | 2 +- src/Cody.Core/Agent/NotificationHandlers.cs | 8 ++++---- src/Cody.Core/Agent/ProgressNotificationHandlers.cs | 2 +- src/Cody.Core/Agent/Protocol/AuthStatus.cs | 2 +- src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs | 2 +- src/Cody.Core/Agent/Protocol/CodyFilePath.cs | 2 +- src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs | 2 +- .../Agent/Protocol/CurrentUserCodySubscription.cs | 2 +- src/Cody.Core/Agent/Protocol/Position.cs | 2 +- src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs | 2 +- .../ProtocolTextDocumentContentChangeEvent.cs | 2 +- src/Cody.Core/Agent/Protocol/Range.cs | 2 +- .../Protocol/ReceiveMessageStringEncodedParams.cs | 2 +- .../Agent/Protocol/ResolveWebviewViewParams.cs | 2 +- src/Cody.Core/Agent/Protocol/ServerInfo.cs | 2 +- .../Agent/Protocol/TextDocumentShowParams.cs | 2 +- .../Agent/Protocol/TextDocumentShowParamsOptions.cs | 2 +- src/Cody.Core/Agent/SetHtmlEvent.cs | 4 ++-- src/Cody.Core/DocumentSync/DocumentSyncCallback.cs | 2 +- src/Cody.Core/DocumentSync/IDocumentSyncActions.cs | 2 +- src/Cody.Core/Ide/IVsVersionService.cs | 2 +- src/Cody.Core/Infrastructure/IStatusbarService.cs | 2 +- src/Cody.Core/Infrastructure/IVersionService.cs | 4 ++-- src/Cody.Core/Infrastructure/VersionService.cs | 2 +- src/Cody.Core/Infrastructure/WebViewsManager.cs | 4 ++-- src/Cody.Core/Logging/ILog.cs | 2 +- src/Cody.Core/Logging/IOutputWindowPane.cs | 2 +- src/Cody.Core/Properties/AssemblyInfo.cs | 2 +- src/Cody.Core/Settings/IUserSettingsProvider.cs | 2 +- src/Cody.UI/Controls/WebView2Dev.xaml.cs | 6 +++--- src/Cody.UI/MVVM/DelegateCommand.cs | 2 +- src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs | 2 +- src/Cody.UI/Properties/AssemblyInfo.cs | 4 ++-- src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs | 4 ++-- src/Cody.UI/ViewModels/MainViewModel.cs | 2 +- src/Cody.UI/Views/MainView.xaml.cs | 2 +- src/Cody.UITester/App.xaml.cs | 2 +- src/Cody.UITester/MainWindow.xaml.cs | 2 +- src/Cody.UITester/Properties/AssemblyInfo.cs | 2 +- src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs | 2 +- src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs | 6 +++--- src/Cody.VisualStudio.Tests/TestsBase.cs | 4 ++-- src/Cody.VisualStudio.Tests/VsVersion.cs | 4 ++-- src/Cody.VisualStudio/Client/AgentClient.cs | 2 +- .../Client/AgentProcessConnector.cs | 2 +- src/Cody.VisualStudio/Client/IAgentConnector.cs | 2 +- src/Cody.VisualStudio/Client/RemoteAgentConnector.cs | 2 +- src/Cody.VisualStudio/CodyToolWindow.cs | 4 ++-- src/Cody.VisualStudio/CommandIDs.cs | 2 +- src/Cody.VisualStudio/Infrastructure/VsConstants.cs | 2 +- src/Cody.VisualStudio/Options/GeneralOptionsPage.cs | 2 +- src/Cody.VisualStudio/Properties/AssemblyInfo.cs | 4 ++-- src/Cody.VisualStudio/Properties/AssemblyVersion.cs | 4 ++-- .../Services/DocumentsSyncService.cs | 12 ++++++------ src/Cody.VisualStudio/Services/StatusbarService.cs | 6 +++--- .../Services/UserSettingsProvider.cs | 2 +- src/Cody.VisualStudio/Services/VsVersionService.cs | 2 +- 59 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/Cody.AgentTester/AssemblyLoader.cs b/src/Cody.AgentTester/AssemblyLoader.cs index 86db1da..31763f7 100644 --- a/src/Cody.AgentTester/AssemblyLoader.cs +++ b/src/Cody.AgentTester/AssemblyLoader.cs @@ -70,10 +70,10 @@ private static string SelectInstallPath() private static string finalPath = null; private static string SelectStreamJsonRpcPath() { - if(!string.IsNullOrEmpty(finalPath)) return finalPath; + if (!string.IsNullOrEmpty(finalPath)) return finalPath; var vsPath = SelectInstallPath(); - foreach(var folder in folders) + foreach (var folder in folders) { var path = Path.Combine(vsPath, folder); var libPath = Path.Combine(path, "StreamJsonRpc.dll"); diff --git a/src/Cody.AgentTester/ConsoleLogger.cs b/src/Cody.AgentTester/ConsoleLogger.cs index a9a8178..7e85520 100644 --- a/src/Cody.AgentTester/ConsoleLogger.cs +++ b/src/Cody.AgentTester/ConsoleLogger.cs @@ -1,4 +1,4 @@ -using Cody.Core.Logging; +using Cody.Core.Logging; using System; using System.Collections.Generic; using System.Linq; @@ -43,7 +43,7 @@ public void Warn(string message, [CallerMemberName] string callerName = "") private void WriteToConsole(string prefix, string message, string callerName, Exception ex = null) { Console.WriteLine($"{prefix.ToUpper()} {callerName}: {message}"); - if(ex != null) Console.WriteLine(ex.ToString()); + if (ex != null) Console.WriteLine(ex.ToString()); } } } diff --git a/src/Cody.AgentTester/Properties/AssemblyInfo.cs b/src/Cody.AgentTester/Properties/AssemblyInfo.cs index f7ff640..ec01563 100644 --- a/src/Cody.AgentTester/Properties/AssemblyInfo.cs +++ b/src/Cody.AgentTester/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/Cody.Core/Agent/NotificationHandlers.cs b/src/Cody.Core/Agent/NotificationHandlers.cs index 34a5eeb..943c273 100644 --- a/src/Cody.Core/Agent/NotificationHandlers.cs +++ b/src/Cody.Core/Agent/NotificationHandlers.cs @@ -50,10 +50,10 @@ public async Task SendWebviewMessage(string handle, string message) bool handled = _messageFilter.HandleMessage(message); if (!handled) await agentClient.ReceiveMessageStringEncoded(new ReceiveMessageStringEncodedParams - { - Id = handle, - MessageStringEncoded = message - }); + { + Id = handle, + MessageStringEncoded = message + }); } [AgentCallback("debug/message")] diff --git a/src/Cody.Core/Agent/ProgressNotificationHandlers.cs b/src/Cody.Core/Agent/ProgressNotificationHandlers.cs index 330b465..f38f4ea 100644 --- a/src/Cody.Core/Agent/ProgressNotificationHandlers.cs +++ b/src/Cody.Core/Agent/ProgressNotificationHandlers.cs @@ -25,7 +25,7 @@ public ProgressNotificationHandlers(IProgressService progressService) public void Start(ProgressStartParams progressStart) { Action cancelAction = null; - if(progressStart.Options.Cancellable == true) + if (progressStart.Options.Cancellable == true) { cancelAction = () => agentService.CancelProgress(progressStart.Id); }; diff --git a/src/Cody.Core/Agent/Protocol/AuthStatus.cs b/src/Cody.Core/Agent/Protocol/AuthStatus.cs index fcea7c6..c2dea2c 100644 --- a/src/Cody.Core/Agent/Protocol/AuthStatus.cs +++ b/src/Cody.Core/Agent/Protocol/AuthStatus.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs b/src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs index ddc98c7..28ea85b 100644 --- a/src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs +++ b/src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs @@ -1,4 +1,4 @@ -namespace Cody.Core.Agent.Protocol +namespace Cody.Core.Agent.Protocol { public class ChatPanelInfo { diff --git a/src/Cody.Core/Agent/Protocol/CodyFilePath.cs b/src/Cody.Core/Agent/Protocol/CodyFilePath.cs index 63a758a..6ad964e 100644 --- a/src/Cody.Core/Agent/Protocol/CodyFilePath.cs +++ b/src/Cody.Core/Agent/Protocol/CodyFilePath.cs @@ -1,4 +1,4 @@ -namespace Cody.Core.Agent.Protocol +namespace Cody.Core.Agent.Protocol { public class CodyFilePath { diff --git a/src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs b/src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs index 87353ca..383ff5d 100644 --- a/src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs +++ b/src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/CurrentUserCodySubscription.cs b/src/Cody.Core/Agent/Protocol/CurrentUserCodySubscription.cs index b39b697..8c3971b 100644 --- a/src/Cody.Core/Agent/Protocol/CurrentUserCodySubscription.cs +++ b/src/Cody.Core/Agent/Protocol/CurrentUserCodySubscription.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/Position.cs b/src/Cody.Core/Agent/Protocol/Position.cs index 17fcdb4..6dccde2 100644 --- a/src/Cody.Core/Agent/Protocol/Position.cs +++ b/src/Cody.Core/Agent/Protocol/Position.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs b/src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs index 8c06f5e..ed0eacb 100644 --- a/src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs +++ b/src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/ProtocolTextDocumentContentChangeEvent.cs b/src/Cody.Core/Agent/Protocol/ProtocolTextDocumentContentChangeEvent.cs index bb8b9e8..289ca29 100644 --- a/src/Cody.Core/Agent/Protocol/ProtocolTextDocumentContentChangeEvent.cs +++ b/src/Cody.Core/Agent/Protocol/ProtocolTextDocumentContentChangeEvent.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/Range.cs b/src/Cody.Core/Agent/Protocol/Range.cs index 3d1976d..3a93edb 100644 --- a/src/Cody.Core/Agent/Protocol/Range.cs +++ b/src/Cody.Core/Agent/Protocol/Range.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/ReceiveMessageStringEncodedParams.cs b/src/Cody.Core/Agent/Protocol/ReceiveMessageStringEncodedParams.cs index b45cf08..252ebc4 100644 --- a/src/Cody.Core/Agent/Protocol/ReceiveMessageStringEncodedParams.cs +++ b/src/Cody.Core/Agent/Protocol/ReceiveMessageStringEncodedParams.cs @@ -1,4 +1,4 @@ -namespace Cody.Core.Agent.Protocol +namespace Cody.Core.Agent.Protocol { public class ReceiveMessageStringEncodedParams { diff --git a/src/Cody.Core/Agent/Protocol/ResolveWebviewViewParams.cs b/src/Cody.Core/Agent/Protocol/ResolveWebviewViewParams.cs index bf2eff0..c9d6ff6 100644 --- a/src/Cody.Core/Agent/Protocol/ResolveWebviewViewParams.cs +++ b/src/Cody.Core/Agent/Protocol/ResolveWebviewViewParams.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Cody.Core.Agent.Protocol { diff --git a/src/Cody.Core/Agent/Protocol/ServerInfo.cs b/src/Cody.Core/Agent/Protocol/ServerInfo.cs index 83e20ad..0fb5eb6 100644 --- a/src/Cody.Core/Agent/Protocol/ServerInfo.cs +++ b/src/Cody.Core/Agent/Protocol/ServerInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/Protocol/TextDocumentShowParams.cs b/src/Cody.Core/Agent/Protocol/TextDocumentShowParams.cs index 37b0d42..7a956ae 100644 --- a/src/Cody.Core/Agent/Protocol/TextDocumentShowParams.cs +++ b/src/Cody.Core/Agent/Protocol/TextDocumentShowParams.cs @@ -1,4 +1,4 @@ -namespace Cody.Core.Agent.Protocol +namespace Cody.Core.Agent.Protocol { public class TextDocumentShowParams { diff --git a/src/Cody.Core/Agent/Protocol/TextDocumentShowParamsOptions.cs b/src/Cody.Core/Agent/Protocol/TextDocumentShowParamsOptions.cs index 8e54be8..82774cf 100644 --- a/src/Cody.Core/Agent/Protocol/TextDocumentShowParamsOptions.cs +++ b/src/Cody.Core/Agent/Protocol/TextDocumentShowParamsOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Agent/SetHtmlEvent.cs b/src/Cody.Core/Agent/SetHtmlEvent.cs index 6d6aeff..2d1bc0f 100644 --- a/src/Cody.Core/Agent/SetHtmlEvent.cs +++ b/src/Cody.Core/Agent/SetHtmlEvent.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Cody.Core.Agent { @@ -20,4 +20,4 @@ public class AgentResponseEvent : EventArgs public string Id { get; set; } public string StringEncodedMessage { get; set; } } -} \ No newline at end of file +} diff --git a/src/Cody.Core/DocumentSync/DocumentSyncCallback.cs b/src/Cody.Core/DocumentSync/DocumentSyncCallback.cs index 67bce99..c1aeb99 100644 --- a/src/Cody.Core/DocumentSync/DocumentSyncCallback.cs +++ b/src/Cody.Core/DocumentSync/DocumentSyncCallback.cs @@ -1,4 +1,4 @@ -using Cody.Core.Agent; +using Cody.Core.Agent; using Cody.Core.Agent.Protocol; using Cody.Core.Logging; using System; diff --git a/src/Cody.Core/DocumentSync/IDocumentSyncActions.cs b/src/Cody.Core/DocumentSync/IDocumentSyncActions.cs index cdd29a3..78badaa 100644 --- a/src/Cody.Core/DocumentSync/IDocumentSyncActions.cs +++ b/src/Cody.Core/DocumentSync/IDocumentSyncActions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Ide/IVsVersionService.cs b/src/Cody.Core/Ide/IVsVersionService.cs index b9f2d72..2d63ae7 100644 --- a/src/Cody.Core/Ide/IVsVersionService.cs +++ b/src/Cody.Core/Ide/IVsVersionService.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Cody.Core.Ide { diff --git a/src/Cody.Core/Infrastructure/IStatusbarService.cs b/src/Cody.Core/Infrastructure/IStatusbarService.cs index c1d9a1f..ee8581c 100644 --- a/src/Cody.Core/Infrastructure/IStatusbarService.cs +++ b/src/Cody.Core/Infrastructure/IStatusbarService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.Core/Infrastructure/IVersionService.cs b/src/Cody.Core/Infrastructure/IVersionService.cs index 9f9c1e7..ae30641 100644 --- a/src/Cody.Core/Infrastructure/IVersionService.cs +++ b/src/Cody.Core/Infrastructure/IVersionService.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Cody.Core.Inf { @@ -11,4 +11,4 @@ public interface IVersionService DateTime BuildDate { get; } void AddBuildMetadata(string build, bool isDebug); } -} \ No newline at end of file +} diff --git a/src/Cody.Core/Infrastructure/VersionService.cs b/src/Cody.Core/Infrastructure/VersionService.cs index c588f0f..2fbe31a 100644 --- a/src/Cody.Core/Infrastructure/VersionService.cs +++ b/src/Cody.Core/Infrastructure/VersionService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; namespace Cody.Core.Inf diff --git a/src/Cody.Core/Infrastructure/WebViewsManager.cs b/src/Cody.Core/Infrastructure/WebViewsManager.cs index 28912ac..f1bf3c6 100644 --- a/src/Cody.Core/Infrastructure/WebViewsManager.cs +++ b/src/Cody.Core/Infrastructure/WebViewsManager.cs @@ -29,7 +29,7 @@ public WebViewEvent(WebViewsEventTypes type, string viewId = null) ViewId = viewId; } - public WebViewsEventTypes Type { get;} + public WebViewsEventTypes Type { get; } public string ViewId { get; } } @@ -181,5 +181,5 @@ public void Dispose() _events?.Dispose(); } } - + } diff --git a/src/Cody.Core/Logging/ILog.cs b/src/Cody.Core/Logging/ILog.cs index b37067e..8676a80 100644 --- a/src/Cody.Core/Logging/ILog.cs +++ b/src/Cody.Core/Logging/ILog.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.CompilerServices; namespace Cody.Core.Logging diff --git a/src/Cody.Core/Logging/IOutputWindowPane.cs b/src/Cody.Core/Logging/IOutputWindowPane.cs index 4f8c5e8..4de7d3c 100644 --- a/src/Cody.Core/Logging/IOutputWindowPane.cs +++ b/src/Cody.Core/Logging/IOutputWindowPane.cs @@ -1,4 +1,4 @@ -namespace Cody.Core.Logging +namespace Cody.Core.Logging { public interface IOutputWindowPane { diff --git a/src/Cody.Core/Properties/AssemblyInfo.cs b/src/Cody.Core/Properties/AssemblyInfo.cs index e0de995..373aac3 100644 --- a/src/Cody.Core/Properties/AssemblyInfo.cs +++ b/src/Cody.Core/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/Cody.Core/Settings/IUserSettingsProvider.cs b/src/Cody.Core/Settings/IUserSettingsProvider.cs index f2339de..7bf1f9b 100644 --- a/src/Cody.Core/Settings/IUserSettingsProvider.cs +++ b/src/Cody.Core/Settings/IUserSettingsProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.UI/Controls/WebView2Dev.xaml.cs b/src/Cody.UI/Controls/WebView2Dev.xaml.cs index 094be34..310f353 100644 --- a/src/Cody.UI/Controls/WebView2Dev.xaml.cs +++ b/src/Cody.UI/Controls/WebView2Dev.xaml.cs @@ -67,7 +67,7 @@ private async Task InitializeWebView() Logger?.Error("Failed.", ex); } - + } private async void WebView_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) @@ -118,7 +118,7 @@ public static async Task PostWebMessageAsJson(string message) public static readonly DependencyProperty HtmlProperty = DependencyProperty.Register( "Html", typeof(string), typeof(WebView2Dev), - new PropertyMetadata(null, async (d, e) => + new PropertyMetadata(null, (d, e) => { _controller.SetHtml(e.NewValue as string); })); @@ -159,7 +159,7 @@ public ICommand SendMessage public static readonly DependencyProperty LoggerProperty = DependencyProperty.Register( "Logger", typeof(ILog), typeof(WebView2Dev), - new PropertyMetadata(null, async (d, e) => + new PropertyMetadata(null, (d, e) => { var logger = e.NewValue as ILog; if (logger != null) diff --git a/src/Cody.UI/MVVM/DelegateCommand.cs b/src/Cody.UI/MVVM/DelegateCommand.cs index a0883dd..accd0b2 100644 --- a/src/Cody.UI/MVVM/DelegateCommand.cs +++ b/src/Cody.UI/MVVM/DelegateCommand.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Windows.Input; diff --git a/src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs b/src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs index 15effcd..0a67a68 100644 --- a/src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs +++ b/src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Linq.Expressions; using System.Runtime.CompilerServices; diff --git a/src/Cody.UI/Properties/AssemblyInfo.cs b/src/Cody.UI/Properties/AssemblyInfo.cs index 72e2e62..6bf0390 100644 --- a/src/Cody.UI/Properties/AssemblyInfo.cs +++ b/src/Cody.UI/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -29,4 +29,4 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file +// [assembly: AssemblyVersion("1.0.*")] diff --git a/src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs b/src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs index 253e9ea..3d8be3a 100644 --- a/src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs +++ b/src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs @@ -5,7 +5,7 @@ namespace Cody.UI.ViewModels { - public class GeneralOptionsViewModel: NotifyPropertyChangedBase + public class GeneralOptionsViewModel : NotifyPropertyChangedBase { private readonly ILog _logger; @@ -31,7 +31,7 @@ private void GetHelpCommandHandler() uri = new Uri("https://community.sourcegraph.com/").AbsoluteUri; Process.Start(new ProcessStartInfo(uri)); } - catch(Exception ex) + catch (Exception ex) { _logger.Error($"Opening '{uri}' failed.", ex); } diff --git a/src/Cody.UI/ViewModels/MainViewModel.cs b/src/Cody.UI/ViewModels/MainViewModel.cs index 4c4c2dc..3d3a5cf 100644 --- a/src/Cody.UI/ViewModels/MainViewModel.cs +++ b/src/Cody.UI/ViewModels/MainViewModel.cs @@ -36,7 +36,7 @@ private void OnPostMessageHandler(object sender, AgentResponseEvent e) }; } - private async void OnWebviewRequestHandler(object sender, SetWebviewRequestEvent e) + private void OnWebviewRequestHandler(object sender, SetWebviewRequestEvent e) { NotificationHandlers.SendWebviewMessage(e.Handle, e.Messsage); } diff --git a/src/Cody.UI/Views/MainView.xaml.cs b/src/Cody.UI/Views/MainView.xaml.cs index cb67f32..b45c0d6 100644 --- a/src/Cody.UI/Views/MainView.xaml.cs +++ b/src/Cody.UI/Views/MainView.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.UITester/App.xaml.cs b/src/Cody.UITester/App.xaml.cs index 821d746..b2ba912 100644 --- a/src/Cody.UITester/App.xaml.cs +++ b/src/Cody.UITester/App.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Configuration; using System.Data; diff --git a/src/Cody.UITester/MainWindow.xaml.cs b/src/Cody.UITester/MainWindow.xaml.cs index b1cd3d0..4c81f50 100644 --- a/src/Cody.UITester/MainWindow.xaml.cs +++ b/src/Cody.UITester/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.UITester/Properties/AssemblyInfo.cs b/src/Cody.UITester/Properties/AssemblyInfo.cs index 5cb56be..94d56c4 100644 --- a/src/Cody.UITester/Properties/AssemblyInfo.cs +++ b/src/Cody.UITester/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs b/src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs index afeda11..bc4c753 100644 --- a/src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs +++ b/src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs @@ -7,7 +7,7 @@ namespace Cody.VisualStudio.Tests { - public class ChatLoggedBasicTests: PlaywrightInitializationTests + public class ChatLoggedBasicTests : PlaywrightInitializationTests { public ChatLoggedBasicTests(ITestOutputHelper output) : base(output) { diff --git a/src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs b/src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs index 46008a9..b0b3439 100644 --- a/src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs +++ b/src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs @@ -11,7 +11,7 @@ namespace Cody.VisualStudio.Tests { - public abstract class PlaywrightTestsBase: TestsBase + public abstract class PlaywrightTestsBase : TestsBase { protected string CdpAddress = $"http://localhost:{9222}"; @@ -145,10 +145,10 @@ protected async Task> GetChatContextTags() var content = await item.TextContentAsync(); var parts = content.Split(':'); tag.Name = parts.First(); - if(parts.Length > 1) + if (parts.Length > 1) { var lines = parts[1].Split('-'); - if(lines.Length > 1) + if (lines.Length > 1) { tag.StartLine = int.Parse(lines[0]); tag.EndLine = int.Parse(lines[1]); diff --git a/src/Cody.VisualStudio.Tests/TestsBase.cs b/src/Cody.VisualStudio.Tests/TestsBase.cs index 6cfac89..df30426 100644 --- a/src/Cody.VisualStudio.Tests/TestsBase.cs +++ b/src/Cody.VisualStudio.Tests/TestsBase.cs @@ -13,7 +13,7 @@ namespace Cody.VisualStudio.Tests { - public abstract class TestsBase: ITestLogger + public abstract class TestsBase : ITestLogger { private readonly ITestOutputHelper _logger; @@ -85,7 +85,7 @@ protected bool IsCodyChatToolWindowOpen() { var guid = new Guid(Guids.CodyChatToolWindowString); UIShell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fFrameOnly, ref guid, out IVsWindowFrame windowFrame); - + return windowFrame.IsVisible() == 0; } diff --git a/src/Cody.VisualStudio.Tests/VsVersion.cs b/src/Cody.VisualStudio.Tests/VsVersion.cs index 9ec7863..87e0ddc 100644 --- a/src/Cody.VisualStudio.Tests/VsVersion.cs +++ b/src/Cody.VisualStudio.Tests/VsVersion.cs @@ -1,7 +1,7 @@ -namespace Cody.VisualStudio.Tests +namespace Cody.VisualStudio.Tests { public static class VsVersion { public const string VS2022 = "2022"; } -} \ No newline at end of file +} diff --git a/src/Cody.VisualStudio/Client/AgentClient.cs b/src/Cody.VisualStudio/Client/AgentClient.cs index 5325418..7cb6eac 100644 --- a/src/Cody.VisualStudio/Client/AgentClient.cs +++ b/src/Cody.VisualStudio/Client/AgentClient.cs @@ -9,7 +9,7 @@ namespace Cody.VisualStudio.Client { - public class AgentClient: IAgentProxy + public class AgentClient : IAgentProxy { private AgentClientOptions options; private ILog log; diff --git a/src/Cody.VisualStudio/Client/AgentProcessConnector.cs b/src/Cody.VisualStudio/Client/AgentProcessConnector.cs index 9f96266..c0bd462 100644 --- a/src/Cody.VisualStudio/Client/AgentProcessConnector.cs +++ b/src/Cody.VisualStudio/Client/AgentProcessConnector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/src/Cody.VisualStudio/Client/IAgentConnector.cs b/src/Cody.VisualStudio/Client/IAgentConnector.cs index 52b2b20..46c8ee3 100644 --- a/src/Cody.VisualStudio/Client/IAgentConnector.cs +++ b/src/Cody.VisualStudio/Client/IAgentConnector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; namespace Cody.VisualStudio.Client diff --git a/src/Cody.VisualStudio/Client/RemoteAgentConnector.cs b/src/Cody.VisualStudio/Client/RemoteAgentConnector.cs index 6ab579a..cbd410d 100644 --- a/src/Cody.VisualStudio/Client/RemoteAgentConnector.cs +++ b/src/Cody.VisualStudio/Client/RemoteAgentConnector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/Cody.VisualStudio/CodyToolWindow.cs b/src/Cody.VisualStudio/CodyToolWindow.cs index 68205a8..5d08c13 100644 --- a/src/Cody.VisualStudio/CodyToolWindow.cs +++ b/src/Cody.VisualStudio/CodyToolWindow.cs @@ -39,7 +39,7 @@ public CodyToolWindow() : base(null) var logger = package.Logger; var notificationsHandlers = package.NotificationHandlers; var webViewsManager = package.WebViewsManager; - + var viewModel = new MainViewModel(webViewsManager, notificationsHandlers, logger); var view = new MainView { @@ -49,7 +49,7 @@ public CodyToolWindow() : base(null) package.MainViewModel = viewModel; package.MainView = view; base.Content = view; - + } private CodyPackage GetPackage() diff --git a/src/Cody.VisualStudio/CommandIDs.cs b/src/Cody.VisualStudio/CommandIDs.cs index 9ef5355..e991bc9 100644 --- a/src/Cody.VisualStudio/CommandIDs.cs +++ b/src/Cody.VisualStudio/CommandIDs.cs @@ -1,4 +1,4 @@ -namespace Cody.VisualStudio +namespace Cody.VisualStudio { internal static class CommandIds { diff --git a/src/Cody.VisualStudio/Infrastructure/VsConstants.cs b/src/Cody.VisualStudio/Infrastructure/VsConstants.cs index af27000..40a38bf 100644 --- a/src/Cody.VisualStudio/Infrastructure/VsConstants.cs +++ b/src/Cody.VisualStudio/Infrastructure/VsConstants.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/Cody.VisualStudio/Options/GeneralOptionsPage.cs b/src/Cody.VisualStudio/Options/GeneralOptionsPage.cs index faf2891..07456d5 100644 --- a/src/Cody.VisualStudio/Options/GeneralOptionsPage.cs +++ b/src/Cody.VisualStudio/Options/GeneralOptionsPage.cs @@ -108,7 +108,7 @@ protected override UIElement Child if (_control == null) { _logger.Debug("Creating options control ..."); - + _control = new GeneralOptionsControl(); _generalOptionsViewModel = new GeneralOptionsViewModel(_logger); _control.DataContext = _generalOptionsViewModel; diff --git a/src/Cody.VisualStudio/Properties/AssemblyInfo.cs b/src/Cody.VisualStudio/Properties/AssemblyInfo.cs index 5cbc18f..de58f61 100644 --- a/src/Cody.VisualStudio/Properties/AssemblyInfo.cs +++ b/src/Cody.VisualStudio/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -26,4 +26,4 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file +// [assembly: AssemblyVersion("1.0.*")] diff --git a/src/Cody.VisualStudio/Properties/AssemblyVersion.cs b/src/Cody.VisualStudio/Properties/AssemblyVersion.cs index 6371427..cd07339 100644 --- a/src/Cody.VisualStudio/Properties/AssemblyVersion.cs +++ b/src/Cody.VisualStudio/Properties/AssemblyVersion.cs @@ -1,5 +1,5 @@ -using System.Reflection; +using System.Reflection; [assembly: AssemblyVersion("0.1.*")] [assembly: AssemblyCopyright("Copyright © 2024-present Sourcegraph Inc.")] -[assembly: AssemblyCompany("Sourcegraph Inc.")] \ No newline at end of file +[assembly: AssemblyCompany("Sourcegraph Inc.")] diff --git a/src/Cody.VisualStudio/Services/DocumentsSyncService.cs b/src/Cody.VisualStudio/Services/DocumentsSyncService.cs index c6ef126..7c85e7c 100644 --- a/src/Cody.VisualStudio/Services/DocumentsSyncService.cs +++ b/src/Cody.VisualStudio/Services/DocumentsSyncService.cs @@ -69,7 +69,7 @@ public void Initialize() } if (activeCookie != 0) - ((IVsRunningDocTableEvents)this).OnBeforeDocumentWindowShow(activeCookie, 0, activeFrame); + ((IVsRunningDocTableEvents)this).OnBeforeDocumentWindowShow(activeCookie, 0, activeFrame); } catch (Exception ex) { @@ -158,8 +158,8 @@ private DocumentRange GetDocumentSelection(IVsTextView textView) bool swap = false; int startLine = 0, startCol = 0, endLine = 0, endCol = 0; if (textView != null && ThreadHelper.CheckAccess()) textView.GetSelection(out startLine, out startCol, out endLine, out endCol); - - if(startLine > endLine || (startLine == endLine && startCol > endCol)) swap = true; + + if (startLine > endLine || (startLine == endLine && startCol > endCol)) swap = true; return new DocumentRange { @@ -207,7 +207,7 @@ int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int fFir if (fFirstShow == 1) { var content = rdt.GetRunningDocumentContents(docCookie); - + var docRange = GetDocumentSelection(textView); var visibleRange = GetVisibleRange(textView); @@ -218,7 +218,7 @@ int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int fFir if (textView != null) { - if(activeDocument != null) + if (activeDocument != null) { activeDocument.TextBuffer.ChangedLowPriority -= OnTextBufferChanged; activeDocument.Selection.SelectionChanged -= OnSelectionChanged; @@ -336,5 +336,5 @@ public class ActiveDocument } } - + } diff --git a/src/Cody.VisualStudio/Services/StatusbarService.cs b/src/Cody.VisualStudio/Services/StatusbarService.cs index c772398..202f3bc 100644 --- a/src/Cody.VisualStudio/Services/StatusbarService.cs +++ b/src/Cody.VisualStudio/Services/StatusbarService.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Shell; using System; using System.Collections.Generic; @@ -25,8 +25,8 @@ public void SetText(string text) statusBar.SetText(text); return Task.CompletedTask; }); - - + + } } } diff --git a/src/Cody.VisualStudio/Services/UserSettingsProvider.cs b/src/Cody.VisualStudio/Services/UserSettingsProvider.cs index c6e2b1a..b8b4e32 100644 --- a/src/Cody.VisualStudio/Services/UserSettingsProvider.cs +++ b/src/Cody.VisualStudio/Services/UserSettingsProvider.cs @@ -17,7 +17,7 @@ public UserSettingsProvider(IServiceProvider serviceProvider) _settingsManager = new ShellSettingsManager(serviceProvider); _userSettingsStore = _settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); - if(!_userSettingsStore.CollectionExists(CollectionName)) + if (!_userSettingsStore.CollectionExists(CollectionName)) _userSettingsStore.CreateCollection(CollectionName); } diff --git a/src/Cody.VisualStudio/Services/VsVersionService.cs b/src/Cody.VisualStudio/Services/VsVersionService.cs index a065ea6..c9f8d31 100644 --- a/src/Cody.VisualStudio/Services/VsVersionService.cs +++ b/src/Cody.VisualStudio/Services/VsVersionService.cs @@ -1,4 +1,4 @@ -using System; +using System; using Cody.Core.Ide; using Cody.Core.Logging; using Microsoft.VisualStudio.Shell.Interop; From e57a247b8010abccc952fb2e824ea0a6c92299bf Mon Sep 17 00:00:00 2001 From: Piotr Karczmarz Date: Thu, 19 Sep 2024 16:11:06 +0200 Subject: [PATCH 3/5] Added dotnet restore. --- .github/workflows/code-style.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 0df61d1..d005766 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Check formatting + - name: Dotnet Restore + run: dotnet restore + + - name: Check Formatting run: dotnet format ./src/ --verify-no-changes -v:diag \ No newline at end of file From 283e158d06b7130db47a62b1d67aab88690efdd6 Mon Sep 17 00:00:00 2001 From: Piotr Karczmarz Date: Thu, 19 Sep 2024 16:14:19 +0200 Subject: [PATCH 4/5] Build fix. --- .github/workflows/code-style.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index d005766..6796656 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -15,7 +15,9 @@ jobs: - uses: actions/checkout@v3 - name: Dotnet Restore - run: dotnet restore + run: | + cd src + dotnet restore - name: Check Formatting run: dotnet format ./src/ --verify-no-changes -v:diag From 96ff0534f872358302e058387c65c2ea02ff9200 Mon Sep 17 00:00:00 2001 From: Piotr Karczmarz Date: Mon, 23 Sep 2024 16:03:54 +0200 Subject: [PATCH 5/5] Removed dotnet restore (no impact) --- .github/workflows/code-style.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 6796656..f9036d8 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -3,7 +3,7 @@ name: Code Style Checks on: push: branches: - - piotr/code-style-checks + - main pull_request: branches: - main @@ -14,11 +14,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Dotnet Restore - run: | - cd src - dotnet restore - - name: Check Formatting run: dotnet format ./src/ --verify-no-changes -v:diag \ No newline at end of file