Skip to content

Commit 3f3ccc4

Browse files
chore: add StringSyntaxAttribute to source generator writer
1 parent 0ce105c commit 3f3ccc4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Shockky.SourceGeneration/Helpers/IndentedTextWriter.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// more info in ThirdPartyNotices.txt in the root of the project.
77

88
using System.ComponentModel;
9+
using System.Diagnostics.CodeAnalysis;
910
using System.Globalization;
1011
using System.Runtime.CompilerServices;
1112
using System.Text;
@@ -115,7 +116,7 @@ public void DecreaseIndent()
115116
/// Writes a block to the underlying buffer.
116117
/// </summary>
117118
/// <returns>A <see cref="Block"/> value to close the open block with.</returns>
118-
public Block WriteBlock(string? clause = default, bool isExpression = false)
119+
public Block WriteBlock([StringSyntax("C#")] string? clause = default, bool isExpression = false)
119120
{
120121
if (clause is not null)
121122
{
@@ -244,7 +245,7 @@ public void WriteLine(bool skipIfPresent = false)
244245
/// </summary>
245246
/// <param name="content">The content to write.</param>
246247
/// <param name="isMultiline">Whether the input content is multiline.</param>
247-
public void WriteLine(string content, bool isMultiline = false)
248+
public void WriteLine([StringSyntax("C#")] string content, bool isMultiline = false)
248249
{
249250
WriteLine(content.AsSpan(), isMultiline);
250251
}
@@ -288,7 +289,7 @@ public void WriteLineIf(bool condition, bool skipIfPresent = false)
288289
/// <param name="condition">The condition to use to decide whether or not to write content.</param>
289290
/// <param name="content">The content to write.</param>
290291
/// <param name="isMultiline">Whether the input content is multiline.</param>
291-
public void WriteLineIf(bool condition, string content, bool isMultiline = false)
292+
public void WriteLineIf(bool condition, [StringSyntax("C#")] string content, bool isMultiline = false)
292293
{
293294
if (condition)
294295
{

Shockky.SourceGeneration/Shockky.SourceGeneration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<Nullable>enable</Nullable>
5-
<LangVersion>preview</LangVersion>
5+
<LangVersion>latest</LangVersion>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
88

0 commit comments

Comments
 (0)