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

Demo of changes that CSharpier makes #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewrondeau-optirtc
Copy link
Collaborator

This pull request merely shows the changes that CSharpier makes to a given piece of code.

For reference: https://github.com/belav/csharpier, and https://github.com/belav/csharpier/blob/master/Src/CSharpier.Tests/Samples/AllInOne.cst

Comment on lines -983 to -992
var res = 0
+ 123 // permitted in C# 1.0 and later
+ 1_2_3 // permitted in C# 7.0 and later
+ 0x1_2_3 // permitted in C# 7.0 and later
+ 0b101 // binary literals added in C# 7.0
+ 0b1_0_1 // permitted in C# 7.0 and later

// in C# 7.2, _ is permitted after the `0x` or `0b`
+ 0x_1_2 // permitted in C# 7.2 and later
+ 0b_1_0_1 // permitted in C# 7.2 and later

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we realign the comments and then re-run, would we lose the alignment again? Or is this only sensitive to the improper leading whitespace

Comment on lines +188 to +190
var dictionaryInitializer = new Dictionary<int, string> { { 1, "" }, { 2, "a" } };
float[] a = new float[] { 0f, 1.1f };
int[,,] cube = {
{ { 111, 112 }, { 121, 122 } },
{ { 211, 212 }, { 221, 222 } }
};
int[,,] cube = { { { 111, 112 }, { 121, 122 } }, { { 211, 212 }, { 221, 222 } } };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... is this intended to force us to encapsulate object construction? Is there any way to have dictionary initialization span multiple lines?

);
var task = Task.Factory.StartNew(async () =>
{
return await new WebClient().DownloadStringTaskAsync("http://example.com");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it allowed to do:

return await new WebClient()
    .DownloadStringTaskAsync("http://example.com");

@andrewrondeau-optirtc
Copy link
Collaborator Author

@hydrojumbo : CSharpier is opinionated. The only options are:

  • Tabs vs spaces (and number of spaces)
  • Max widths of lines

So the answer to all of your questions is a very firm: You can't make any changes to the formatting it applies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants