Skip to content

Commit 708be3f

Browse files
authored
Fix analyzer RCS0056 - interpolated string (#1521)
1 parent d42621c commit 708be3f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Fix analyzer [RCS0053](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0053) ([PR](https://github.com/dotnet/roslynator/pull/1518))
13+
- Fix analyzer [RCS0056](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0056) ([PR](https://github.com/dotnet/roslynator/pull/1521))
1314

1415
## [4.12.5] - 2024-09-13
1516

src/Formatting.Analyzers/CSharp/LineIsTooLongAnalyzer.cs

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private static void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
115115
SyntaxKind.InterpolatedRawStringEndToken,
116116
SyntaxKind.MultiLineRawStringLiteralToken,
117117
#endif
118+
SyntaxKind.InterpolatedStringTextToken,
118119
SyntaxKind.InterpolatedStringEndToken))
119120
{
120121
SyntaxNode parent = token2.Parent;

src/Tests/Formatting.Analyzers.Tests/RCS0056LineIsTooLongTests.cs

+18
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,24 @@ static void M(string x, int y)
13051305
0);
13061306
}
13071307
}
1308+
"""");
1309+
}
1310+
1311+
[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.LineIsTooLong)]
1312+
public async Task TestNoDiagnostic_LongRawStringLiteral2()
1313+
{
1314+
await VerifyNoDiagnosticAsync(""""
1315+
class C
1316+
{
1317+
void M()
1318+
{
1319+
string x = "x";
1320+
var value = $$"""
1321+
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1322+
{{x}}
1323+
""";
1324+
}
1325+
}
13081326
"""");
13091327
}
13101328
}

0 commit comments

Comments
 (0)