dotnet format breaks indentation in .cs files with records
See original GitHub issueThis is the result of dotnet format (freshly installed,
using EnoCore.Models.Database;
using EnoCore.Utils;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace EnoCore.Models.Json
{
public class JsonConfigurationValidationException : Exception
{
public JsonConfigurationValidationException(string message) : base(message) { }
}
public sealed record JsonConfiguration
{
public string? Title { get; set; }
public long FlagValidityInRounds { get; set; }
public int CheckedRoundsPerRound { get; set; }
public int RoundLengthInSeconds { get; set; }
public string? DnsSuffix { get; set; }
public int TeamSubnetBytesLength { get; set; }
public string? FlagSigningKey { get; set; }
public string? NoiseSigningKey { get; set; }
[...]
public static JsonConfiguration? Deserialize(string json)
{
return JsonSerializer.Deserialize<JsonConfiguration>(json, JsonSerializerOptions);
}
}
}
As you can see, it shifted everything in the file after the first property to the left.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Prettier-style line breaking · Issue #246 · dotnet/format
It's my understanding the the project doesn't do line breaking the way Prettier does: Inserting and removing line breaks depending on the ...
Read more >c# - What is the simplest way to get indented XML with line ...
Based on the other answers, I looked into XmlTextWriter and came up with the following helper method: static public string Beautify(this ...
Read more >C# formatting options - .NET
Learn about the code style options for formatting C# code files. ... New-line options; Indentation options; Spacing options; Wrap options ...
Read more >Weird auto-formatting indentation : r/VisualStudio
I have this problem in razor files only. It seems like a bug to me.
Read more >EditorConfig properties for C#: Tabs, Indents, Alignment
This page lists custom ReSharper EditorConfig properties that you can use to configure formatting preferences in C#, specifically, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Installing latest v5 with:
fixes the issue for me
Closing this issue as it has been resolved by taking an updated Roslyn dependency.