csharpier
csharpier copied to clipboard
CSharpier is an opinionated code formatter for c#.
This changes settings storage from the project level to the global settings, allowing users to configure CSharpier once, and not for each solution they open. I was able to test...
Full disclosure, I rarely use Java, no idea if this works, not sure how to debug plugins. I'm hoping the CI has a test for this. Edit: Looks like I...
Repeatedly compiling regex for ignore files is a significant amount of runtime, caches the `IgnoreWithBasePath` to prevent this. ### Before | Method | Mean | Error | StdDev | Gen0...
Use `FileSystemEnumerator` to replace `Directory.EnumerateFiles`, this will only match valid CSharpier file types and skips large always ignored directories, like `/bin` or `/.git` Note that this doesn't use `IFileSystem.Directory.EnumerateFiles` I've...
Delay calling `string.Replace` until after the ignore check. Saves 7.8MB when I run it on the CSharpier repo ## Before ## After
- Uses `ValueTask` to avoid allocating a `Task` in synchronous paths - Use a `stackalloc` `Span` to resize and reformat paths - Avoid closure allocations for `Func` Saves around 5...
- Compare the old and formatted code before using `SyntaxNodeComparer` (ie new version of csharpier, no changes but hash is cache is invalidated) - Skip comparison if two `TypeDeclaration` aka...
Updates DiffEngine to the latest version
It appears that `SyntaxNodeComparer` is run after a file is formated, optimisation here may be impactful - Prevent null `Func` allocations (still seeing some in the profiler, no idea how...
Use static `Func` to prevent closure capture of `context`. ### Benchmarks (Timing is inaccurate) Saves memory for attribute heavy files aka test files. #### Before | Method | Mean |...