dotnet / dotnet/format

Any plans to release this as a library

Open
#443 1 comment 2 reactions 0 assignees View on GitHub
Question
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

Having this available as a library would be great for homegrown tools.

We do some code generation with razor and currently format the resulting string with:

```csharp
var contents = Razor.CompileRenderStringAsync(name, template, model).GetAwaiter().GetResult();
var tree = CSharpSyntaxTree.ParseText(contents);
var root = tree.GetRoot().NormalizeWhitespace(indentation:"\t", "\n");
return root.ToFullString();
```

It would be great if we can instead use something like this

```csharp
var formatted = new CsharpFormatter("path_to_editorconfig_file").FormatString("csharp_string");
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.