Skip to content

Commit b6fe2cf

Browse files
committed
Enable JSON language injection
So that your Integrated Development Environment (IDE) can perform nice syntax highlighting. See [Language injections in C#][1] in Rider for example. Also remove some trailing commas that were highlighted after adding the // language=json comment [1]: https://www.jetbrains.com/help/rider/Language_Injections.html
1 parent 70d8b95 commit b6fe2cf

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

test/Serilog.Settings.Configuration.Tests/ConfigurationReaderTests.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public ConfigurationReaderTests()
2323
[Fact]
2424
public void WriteToSupportSimplifiedSyntax()
2525
{
26+
// language=json
2627
var json = """
2728
{
2829
"WriteTo": [ "LiterateConsole", "DiagnosticTrace" ]
@@ -41,6 +42,7 @@ public void WriteToSupportSimplifiedSyntax()
4142
[Fact]
4243
public void WriteToSupportExpandedSyntaxWithoutArgs()
4344
{
45+
// language=json
4446
var json = """
4547
{
4648
"WriteTo": [ {
@@ -59,13 +61,14 @@ public void WriteToSupportExpandedSyntaxWithoutArgs()
5961
[Fact]
6062
public void WriteToSupportExpandedSyntaxWithArgs()
6163
{
64+
// language=json
6265
var json = """
6366
{
6467
"WriteTo": [ {
6568
"Name": "LiterateConsole",
6669
"Args": {
6770
"outputTemplate": "{Message}"
68-
},
71+
}
6972
}]
7073
}
7174
""";
@@ -87,28 +90,29 @@ public void WriteToSupportExpandedSyntaxWithArgs()
8790
[Fact]
8891
public void WriteToSupportMultipleSinksOfTheSameKind()
8992
{
93+
// language=json
9094
var json = """
9195
{
9296
"WriteTo": [
9397
{
9498
"Name": "LiterateConsole",
9599
"Args": {
96100
"outputTemplate": "{Message}"
97-
},
101+
}
98102
},
99103
"DiagnosticTrace"
100104
],
101105
"WriteTo:File1": {
102106
"Name": "File",
103107
"Args": {
104108
"outputTemplate": "{Message}"
105-
},
109+
}
106110
},
107111
"WriteTo:File2": {
108112
"Name": "File",
109113
"Args": {
110114
"outputTemplate": "{Message}"
111-
},
115+
}
112116
}
113117
}
114118
""";
@@ -128,6 +132,7 @@ public void WriteToSupportMultipleSinksOfTheSameKind()
128132
[Fact]
129133
public void Enrich_SupportSimplifiedSyntax()
130134
{
135+
// language=json
131136
var json = """
132137
{
133138
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
@@ -273,6 +278,7 @@ public void MixedMinimumLevelCorrectOneIsEnabledOnLogger(IConfigurationRoot root
273278
[Fact]
274279
public void NoConfigurationRootUsedStillValid()
275280
{
281+
// language=json
276282
var json = """
277283
{
278284
"Nest": {

0 commit comments

Comments
 (0)