Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two newlines in the csx or .NET 6 program files without types #501

Closed
Ciantic opened this issue Dec 1, 2021 · 0 comments · Fixed by #502
Closed

Two newlines in the csx or .NET 6 program files without types #501

Ciantic opened this issue Dec 1, 2021 · 0 comments · Fixed by #502
Milestone

Comments

@Ciantic
Copy link

Ciantic commented Dec 1, 2021

With new style Main (where you don't have Program class) the csharpier seems to add two new lines between expressions. Presumably because it's common to have two newlines between types? But with new style Main they are not types in the top level anymore.

This happens e.g. with CSX files or .NET 6 program files, here is a formatted output from csharpier:

var t = new TaskQueue(maxParallelizationCount: 2, maxQueueLength: 2);
t.Queue(() => DoTask(1)); // Runs this on 1st batch.


// Works even without following `Wait()`, in that case the first
// starts immediately the second near instantly following, and third
// waits until either 1 or 2 completes.
t.Process().Wait();
Console.WriteLine("First batch should have ran to completion.");
Console.WriteLine("");


t.Queue(() => DoTask(2)); // Runs this on 2nd batch
t.Queue(() => DoTask(3)); // Runs this on 2nd batch
try
{
    t.Queue(() => DoTask(4)); // Not ran, capped
}
catch (TaskQueue.QueueLimitReachedException)
{
    Console.WriteLine("Queue limit reached");
}


t.Process().Wait();
Console.WriteLine($"Processed second batch. Queue and running tasks should be empty.");
Console.WriteLine(
    $"Queue has now {t.GetQueueCount()} future tasks, and {t.GetRunningCount()} running tasks."
);
Console.WriteLine("");


t.Queue(() => DoTask(7)); // Runs this on 2nd batch
t.Queue(() => DoTask(8)); // Runs this on 2nd batch


try
{
    t.Queue(() => DoTask(9)); // Not ran, capped
}
catch (TaskQueue.QueueLimitReachedException)
{
    Console.WriteLine("Queue limit reached 2");
}
Console.WriteLine($"Queued. Queue should have two future tasks, and nothing running yet.");
Console.WriteLine(
    $"Queue has now {t.GetQueueCount()} future tasks, and {t.GetRunningCount()} running tasks."
);


t.Process().Wait();
Console.WriteLine("Completed, press enter to quit.");
Console.ReadLine();
Console.WriteLine("The End!");

It added double new lines there.

@belav belav closed this as completed in 28118cb Dec 1, 2021
belav added a commit that referenced this issue Dec 1, 2021
@belav belav reopened this Dec 1, 2021
@belav belav added this to the 0.13.0 milestone Dec 1, 2021
@belav belav closed this as completed in #502 Dec 1, 2021
belav added a commit that referenced this issue Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants