Fix C# style with dotnet format

This commit is contained in:
Raul Santos 2022-08-27 03:22:23 +02:00
parent 390333e822
commit d35c58507c
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
12 changed files with 158 additions and 139 deletions

View file

@ -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 };
}
}

View file

@ -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 };
}
}

View file

@ -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)
{

View file

@ -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);
}
}

View file

@ -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()

View file

@ -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 });
}
}
}

View file

@ -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;

View file

@ -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);

View file

@ -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 });
}
}

View file

@ -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;

View file

@ -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]