Skip to content

Commit b535089

Browse files
committed
Update doc for overrides, it is a glob not an array
1 parent c6025ad commit b535089

3 files changed

Lines changed: 69 additions & 42 deletions

File tree

Src/CSharpier.Tests/OptionsProviderTests.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ public async Task Should_Return_UseTabs_With_Yaml()
238238
}
239239

240240
[Test]
241-
public async Task Should_Return_IndentSize_For_Override()
241+
public async Task Should_Return_IndentSize_For_Override_With_Yaml()
242242
{
243243
var context = new TestContext();
244244
context.WhenAFileExists(
245245
"c:/test/.csharpierrc",
246246
"""
247247
overrides:
248-
- files: "*.override"
248+
- files: "*.{override,another}"
249249
formatter: "csharp"
250250
indentSize: 2
251251
"""
@@ -259,6 +259,33 @@ public async Task Should_Return_IndentSize_For_Override()
259259
result.IndentSize.Should().Be(2);
260260
}
261261

262+
[Test]
263+
public async Task Should_Return_IndentSize_For_Override_With_Json()
264+
{
265+
var context = new TestContext();
266+
context.WhenAFileExists(
267+
"c:/test/.csharpierrc",
268+
"""
269+
{
270+
"overrides": [
271+
{
272+
"files": "*.{override,another}",
273+
"formatter": "csharp",
274+
"indentSize": 2
275+
}
276+
]
277+
}
278+
"""
279+
);
280+
281+
var result = await context.CreateProviderAndGetOptionsFor(
282+
"c:/test",
283+
"c:/test/test.override"
284+
);
285+
286+
result.IndentSize.Should().Be(2);
287+
}
288+
262289
[TestCase("cs")]
263290
[TestCase("csx")]
264291
public async Task Should_Return_Default_CSharp_Options_With_Empty_EditorConfig(string extension)

Src/Website/docs/Configuration.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ The configuration file will be resolved based on the location of the file being
1414
JSON
1515
```json
1616
{
17-
"printWidth": 100,
18-
"useTabs": false,
19-
"indentSize": 4,
20-
"endOfLine": "auto"
17+
"printWidth": 100,
18+
"useTabs": false,
19+
"indentSize": 4,
20+
"endOfLine": "auto"
2121
}
2222
```
2323
YAML
@@ -57,27 +57,27 @@ Overrides allows you to specify different configuration options based on glob pa
5757

5858
```json
5959
{
60-
"overrides": [
61-
{
62-
"files": ["*.cst"],
63-
"formatter": "csharp",
64-
"indentSize": 2,
65-
"useTabs": true,
66-
"printWidth": 10,
67-
"endOfLine": "LF"
68-
}
69-
]
60+
"overrides": [
61+
{
62+
"files": "*.{csr,cst}",
63+
"formatter": "csharp",
64+
"indentSize": 2,
65+
"useTabs": true,
66+
"printWidth": 10,
67+
"endOfLine": "LF"
68+
}
69+
]
7070
}
7171
```
7272

7373
```yaml
7474
overrides:
75-
- files: "*.cst"
76-
formatter: "csharp"
77-
indentSize: 2
78-
useTabs: true
79-
printWidth: 10
80-
endOfLine: "LF"
75+
- files: "*.{csr,cst}"
76+
formatter: "csharp"
77+
indentSize: 2
78+
useTabs: true
79+
printWidth: 10
80+
endOfLine: "LF"
8181
```
8282

8383
### EditorConfig

docs/Configuration.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ The configuration file will be resolved based on the location of the file being
1414
JSON
1515
```json
1616
{
17-
"printWidth": 100,
18-
"useTabs": false,
19-
"indentSize": 4,
20-
"endOfLine": "auto"
17+
"printWidth": 100,
18+
"useTabs": false,
19+
"indentSize": 4,
20+
"endOfLine": "auto"
2121
}
2222
```
2323
YAML
@@ -57,27 +57,27 @@ Overrides allows you to specify different configuration options based on glob pa
5757

5858
```json
5959
{
60-
"overrides": [
61-
{
62-
"files": ["*.cst"],
63-
"formatter": "csharp",
64-
"indentSize": 2,
65-
"useTabs": true,
66-
"printWidth": 10,
67-
"endOfLine": "LF"
68-
}
69-
]
60+
"overrides": [
61+
{
62+
"files": "*.{csr,cst}",
63+
"formatter": "csharp",
64+
"indentSize": 2,
65+
"useTabs": true,
66+
"printWidth": 10,
67+
"endOfLine": "LF"
68+
}
69+
]
7070
}
7171
```
7272

7373
```yaml
7474
overrides:
75-
- files: "*.cst"
76-
formatter: "csharp"
77-
indentSize: 2
78-
useTabs: true
79-
printWidth: 10
80-
endOfLine: "LF"
75+
- files: "*.{csr,cst}"
76+
formatter: "csharp"
77+
indentSize: 2
78+
useTabs: true
79+
printWidth: 10
80+
endOfLine: "LF"
8181
```
8282

8383
### EditorConfig

0 commit comments

Comments
 (0)