Skip to content

Commit 56a7ff7

Browse files
authored
Releasing 0.19.0 (#714)
1 parent 9f9e0a5 commit 56a7ff7

File tree

6 files changed

+88
-20
lines changed

6 files changed

+88
-20
lines changed

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# 0.19.0
2+
## What's Changed
3+
#### Adding a cache to speed up formatting. [#692](https://github.com/belav/csharpier/issues/692)
4+
CSharpier now caches information about files that it has formatted to speed up subsequent runs.
5+
By default the following are used as cache keys and a file is only formatted if one of them has changed.
6+
7+
- CSharpier Version
8+
- CSharpier Options
9+
- Content of the file
10+
11+
The cache is stored at [LocalApplicationData]/CSharpier/.formattingCache.
12+
13+
#### Ignore node_modules [#699](https://github.com/belav/csharpier/issues/699)
14+
15+
CSharpier now ignores any files within a node_modules folder.
16+
17+
Thanks go to @RichiCoder1 for the suggestion and @SubjectAlpha for the implementation.
18+
19+
#### Extra space before curly brace in array initializer [#693](https://github.com/belav/csharpier/issues/693)
20+
21+
```c#
22+
// 0.18.0
23+
public class ClassName
24+
{
25+
public int[] SomeArray { get; set; } = { 1, 2, 3 };
26+
}
27+
// 0.19.0
28+
public class MyClass
29+
{
30+
public int[] SomeArray { get; set; } = { 1, 2, 3 };
31+
}
32+
33+
```
34+
35+
Thanks go to @TiraelSedai for reporting the bug.
36+
37+
**Full Changelog**: https://github.com/belav/csharpier/compare/0.18.0...0.19.0
38+
39+
140
# 0.18.0
241
## What's Changed
342
#### Initial C# 11 support [#686](https://github.com/belav/csharpier/pull/686)

CSharpier.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.18.0</Version>
3+
<Version>0.19.0</Version>
44
<PackageLicenseExpression>MIT</PackageLicenseExpression>
55
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
66
<RepositoryType>git</RepositoryType>

Src/Website/docs/About.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,38 @@ The printing process was ported from [prettier](https://github.com/prettier/pret
99

1010
CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html) of prettier.
1111

12+
### Quick Start
13+
Install CSharpier globally using the following command.
14+
```bash
15+
dotnet tool install csharpier -g
16+
```
17+
Then format the contents of a directory and its children with the following command.
18+
```bash
19+
dotnet csharpier .
20+
```
21+
22+
CSharpier can also format [on save in your editor](https://csharpier.com/docs/Editors) or as a [pre-commit hook](https://csharpier.com/docs/Pre-commit). Then you can ensure code was formatted with a [CI/CD tool](https://csharpier.com/docs/ContinuousIntegration).
23+
24+
---
25+
26+
[Try it out](https://playground.csharpier.com)
27+
28+
---
29+
1230
### Before
13-
```csharp
31+
```c#
1432
public class ClassName {
15-
public string ShortPropertyName {
16-
get;
17-
set;
18-
}
19-
20-
public void LongUglyMethod(string longParameter1, string longParameter2, string longParameter3) {
33+
public void CallMethod() {
2134
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
2235
}
2336
}
2437
```
2538

2639
### After
27-
```csharp
40+
```c#
2841
public class ClassName
2942
{
30-
public string ShortPropertyName { get; set; }
31-
32-
public void LongUglyMethod(
33-
string longParameter1,
34-
string longParameter2,
35-
string longParameter3
36-
)
43+
public void CallMethod()
3744
{
3845
this.LongUglyMethod(
3946
"1234567890",
@@ -42,3 +49,4 @@ public class ClassName
4249
);
4350
}
4451
}
52+
```

Src/Website/docs/CLI.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
22
hide_table_of_contents: true
33
---
4+
Use the `dotnet csharpier` command to run CSharpier from the command line.
5+
6+
In practice, it will look something like:
7+
```
8+
dotnet csharpier .
9+
```
10+
This command will format all c# files in the current directory and its children.
11+
12+
You may want to set up an [ignore file](Ignore.md) or [configuration file](Configuration.md).
13+
414
### Command Line Options
515
```console
616
Usage:
@@ -11,6 +21,7 @@ Arguments:
1121

1222
Options:
1323
--check Check that files are formatted. Will not write any changes.
24+
--no-cache Bypass the cache to determine if a file needs to be formatted.
1425
--fast Skip comparing syntax tree of formatted file to original file to validate changes.
1526
--skip-write Skip writing changes. Generally used for testing to ensure csharpier doesn't throw any errors or cause syntax tree validation failures.
1627
--write-stdout Write the results of formatting any files to stdout.
@@ -33,11 +44,20 @@ If a list of paths is not supplied, then stdin is read.
3344
Used to check if your files are already formatted. Outputs any files that have not already been formatted.
3445
This will return exit code 1 if there are unformatted files which is useful for CI pipelines.
3546

47+
### --no-cache
48+
This option can be used to bypass the cache that is normally used to speed up formatting files.
49+
By default the following are used as cache keys and a file is only formatted if one of them has changed.
50+
* CSharpier Version
51+
* CSharpier Options
52+
* Content of the file
53+
54+
The cache is stored at `[LocalApplicationData]/CSharpier/.formattingCache`.
55+
3656
### --fast
3757
CSharpier validates the changes it makes to a file.
3858
It does this by comparing the syntax tree before and after formatting, but ignoring any whitespace trivia in the syntax tree.
3959
If a file fails validation, CSharpier will output the lines that differ. If this happens it indicates a bug in CSharpier's code.
40-
This validation may be skipped by passing the --fast argument. Validation appears to increase the formatting time by ~50%.
60+
This validation may be skipped by passing the --fast argument.
4161

4262
An example of CSharpier finding a file that failed validation.
4363
```

Src/Website/docs/ContinuousIntegration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Normally when using a code formatter like CSharpier, you'll want to ensure that
2222
2. Use your preferred CI/CD tool to run the following commands.
2323
```bash
2424
dotnet tool restore
25-
dotnet-csharpier --check
25+
dotnet-csharpier . --check
2626
```
2727
An example of a github action to accomplish this
2828
```yaml
@@ -38,7 +38,7 @@ Normally when using a code formatter like CSharpier, you'll want to ensure that
3838
- uses: actions/checkout@v2
3939
- run: |
4040
dotnet tool restore
41-
dotnet csharpier --check
41+
dotnet csharpier . --check
4242
4343
```
4444

Src/Website/docs/ExtensionTestCases.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
- Formatting
1414
- Existing open documents get warmed
1515
- Edit warms
16-
- Finds local version
16+
- Finds msbuild version in csproj
17+
- Finds local version in dotnet tools
1718
- Finds global version
1819
- Uses correct version - use 0.12.0, ensure that it adds blank lines between methods
1920
- Unsaved document can be formatted (may just apply to vscode)

0 commit comments

Comments
 (0)