diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-29 07:03:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 07:03:20 +0200 |
commit | 4333f785f6c5f94b8c9822af1860d9462c617cd1 (patch) | |
tree | 34e50818de3e4506d8177d3a36e5bf1f8592af7b /modules/mono/editor | |
parent | 58f8f3a40e8b068b9f7b92cae21e0cabb406dd07 (diff) | |
parent | ea6b8ecb6fb535004e7a3e8ce6ac7673665144b8 (diff) |
Merge pull request #64956 from raulsntos/dotnet/format-ci
Add `dotnet format` to CI to check C# style
Diffstat (limited to 'modules/mono/editor')
11 files changed, 46 insertions, 27 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs index ac9f59aa99..ac8d6473a6 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs @@ -94,16 +94,20 @@ namespace Godot.SourceGenerators.Sample [Export] private NodePath field_NodePath = new NodePath("foo"); [Export] private RID field_RID; - [Export] private Godot.Collections.Dictionary field_GodotDictionary = + [Export] + private Godot.Collections.Dictionary field_GodotDictionary = new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } }; - [Export] private Godot.Collections.Array field_GodotArray = + [Export] + private Godot.Collections.Array field_GodotArray = new() { "foo", 10, Vector2.Up, Colors.Chocolate }; - [Export] private Godot.Collections.Dictionary<string, bool> field_GodotGenericDictionary = + [Export] + private Godot.Collections.Dictionary<string, bool> field_GodotGenericDictionary = new() { { "foo", true }, { "bar", false } }; - [Export] private Godot.Collections.Array<int> field_GodotGenericArray = + [Export] + private Godot.Collections.Array<int> field_GodotGenericArray = new() { 0, 1, 2, 3, 4, 5, 6 }; } } diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs index 4a0e8075f0..3020cfbc50 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs @@ -94,16 +94,20 @@ namespace Godot.SourceGenerators.Sample [Export] private NodePath property_NodePath { get; set; } = new NodePath("foo"); [Export] private RID property_RID { get; set; } - [Export] private Godot.Collections.Dictionary property_GodotDictionary { get; set; } = + [Export] + private Godot.Collections.Dictionary property_GodotDictionary { get; set; } = new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } }; - [Export] private Godot.Collections.Array property_GodotArray { get; set; } = + [Export] + private Godot.Collections.Array property_GodotArray { get; set; } = new() { "foo", 10, Vector2.Up, Colors.Chocolate }; - [Export] private Godot.Collections.Dictionary<string, bool> property_GodotGenericDictionary { get; set; } = + [Export] + private Godot.Collections.Dictionary<string, bool> property_GodotGenericDictionary { get; set; } = new() { { "foo", true }, { "bar", false } }; - [Export] private Godot.Collections.Array<int> property_GodotGenericArray { get; set; } = + [Export] + private Godot.Collections.Array<int> property_GodotGenericArray { get; set; } = new() { 0, 1, 2, 3, 4, 5, 6 }; } } diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs index 60a4f297c9..7c5502814f 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs +++ b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs @@ -34,7 +34,7 @@ namespace GodotTools.Core path = path.Replace('\\', '/'); path = path[path.Length - 1] == '/' ? path.Substring(0, path.Length - 1) : path; - string[] parts = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries); + string[] parts = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim(); @@ -60,7 +60,7 @@ namespace GodotTools.Core public static string ToSafeDirName(this string dirName, bool allowDirSeparator = false) { - var invalidChars = new List<string> {":", "*", "?", "\"", "<", ">", "|"}; + var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" }; if (allowDirSeparator) { diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Client.cs b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Client.cs index bc09e1ebf9..72e2a1fc0d 100644 --- a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Client.cs +++ b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Client.cs @@ -123,12 +123,16 @@ namespace GodotTools.IdeMessaging string projectMetadataDir = Path.Combine(godotProjectDir, ".godot", "mono", "metadata"); // FileSystemWatcher requires an existing directory - if (!Directory.Exists(projectMetadataDir)) { + if (!Directory.Exists(projectMetadataDir)) + { // Check if the non hidden version exists string nonHiddenProjectMetadataDir = Path.Combine(godotProjectDir, "godot", "mono", "metadata"); - if (Directory.Exists(nonHiddenProjectMetadataDir)) { + if (Directory.Exists(nonHiddenProjectMetadataDir)) + { projectMetadataDir = nonHiddenProjectMetadataDir; - } else { + } + else + { Directory.CreateDirectory(projectMetadataDir); } } diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Peer.cs b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Peer.cs index 10d7e1898e..dd3913b4f3 100644 --- a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Peer.cs +++ b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/Peer.cs @@ -78,7 +78,7 @@ namespace GodotTools.IdeMessaging clientStream.WriteTimeout = ClientWriteTimeout; clientReader = new StreamReader(clientStream, Encoding.UTF8); - clientWriter = new StreamWriter(clientStream, Encoding.UTF8) {NewLine = "\n"}; + clientWriter = new StreamWriter(clientStream, Encoding.UTF8) { NewLine = "\n" }; } public async Task Process() diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/ResponseAwaiter.cs b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/ResponseAwaiter.cs index 548e7f06ee..a57c82b608 100644 --- a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/ResponseAwaiter.cs +++ b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/ResponseAwaiter.cs @@ -17,7 +17,7 @@ namespace GodotTools.IdeMessaging if (content.Status == MessageStatus.Ok) SetResult(JsonConvert.DeserializeObject<T>(content.Body)); else - SetResult(new T {Status = content.Status}); + SetResult(new T { Status = content.Status }); } } } diff --git a/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/Program.cs b/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/Program.cs index 7a4641dbbc..cc0deb6cc0 100644 --- a/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/Program.cs +++ b/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/Program.cs @@ -249,8 +249,8 @@ namespace GodotTools.OpenVisualStudio // Thread call was rejected, so try again. int IOleMessageFilter.RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType) { + // flag = SERVERCALL_RETRYLATER if (dwRejectType == 2) - // flag = SERVERCALL_RETRYLATER { // Retry the thread call immediately if return >= 0 & < 100 return 99; diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs index b7267a13c5..2184cae6d6 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs @@ -76,13 +76,20 @@ namespace GodotTools.Export else { string arch = ""; - if (features.Contains("x86_64")) { + if (features.Contains("x86_64")) + { arch = "x86_64"; - } else if (features.Contains("x86_32")) { + } + else if (features.Contains("x86_32")) + { arch = "x86_32"; - } else if (features.Contains("arm64")) { + } + else if (features.Contains("arm64")) + { arch = "arm64"; - } else if (features.Contains("arm32")) { + } + else if (features.Contains("arm32")) + { arch = "arm32"; } CompileAssembliesForDesktop(exporter, platform, isDebug, arch, aotOpts, aotTempDir, outputDataDir, assembliesPrepared, bclDir); diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs index 77f8661d6f..9df90ac608 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/GodotIdeManager.cs @@ -180,17 +180,17 @@ namespace GodotTools.Ides public void SendOpenFile(string file) { - SendRequest<OpenFileResponse>(new OpenFileRequest {File = file}); + SendRequest<OpenFileResponse>(new OpenFileRequest { File = file }); } public void SendOpenFile(string file, int line) { - SendRequest<OpenFileResponse>(new OpenFileRequest {File = file, Line = line}); + SendRequest<OpenFileResponse>(new OpenFileRequest { File = file, Line = line }); } public void SendOpenFile(string file, int line, int column) { - SendRequest<OpenFileResponse>(new OpenFileRequest {File = file, Line = line, Column = column}); + SendRequest<OpenFileResponse>(new OpenFileRequest { File = file, Line = line, Column = column }); } } diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs index 6f11831b80..62db6e3af5 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/MessagingServer.cs @@ -385,7 +385,7 @@ namespace GodotTools.Ides // However, it doesn't fix resource loading if the rest of the path is also case insensitive. string scriptFileLocalized = FsPathUtils.LocalizePathWithCaseChecked(request.ScriptFile); - var response = new CodeCompletionResponse {Kind = request.Kind, ScriptFile = request.ScriptFile}; + var response = new CodeCompletionResponse { Kind = request.Kind, ScriptFile = request.ScriptFile }; response.Suggestions = await Task.Run(() => Internal.CodeCompletionRequest(response.Kind, scriptFileLocalized ?? request.ScriptFile)); return response; diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs index 3ef6debd3a..b5e4ae7a28 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs @@ -206,10 +206,10 @@ namespace GodotTools.Utils return searchDirs.Select(dir => Path.Combine(dir, name)).FirstOrDefault(File.Exists); return (from dir in searchDirs - select Path.Combine(dir, name) + select Path.Combine(dir, name) into path - from ext in windowsExts - select path + ext).FirstOrDefault(File.Exists); + from ext in windowsExts + select path + ext).FirstOrDefault(File.Exists); } [return: MaybeNull] |