Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

JetBrains Rider: keep single line scope

I press Ctrl+Shift+L in JetBrains Rider, which opens a dialog window. I select Whole Solution, and it starts cleaning up the code. However, I want it to stop transforming this:

public Task<PackageTest?> GetByPackageAndTestIdAsync(Guid packageId, Guid testId) =>
    _context.PackageTests.FirstOrDefaultAsync(p => p.TestId == testId && p.PackageId == packageId);

into this:

public Task<PackageTest?> GetByPackageAndTestIdAsync(Guid packageId, Guid testId)
{
    return _context.PackageTests.FirstOrDefaultAsync(p => p.TestId == testId && p.PackageId == packageId);
}

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try turning off "Apply code body style (expression body vs block body)".

  1. Open Code(menu) -> Reformat and CleanUp
  2. From the ‘Select Profile’ select the profile that you’re using
  3. Click on the edit icon at the top of the left frame.
  4. On the ‘Code Cleanup Options’ Window turn off ‘Apply code body style (expression body vs block body)’ in the ‘Apply syntax styles’ -> ‘C#’.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading