From 42297d8aaddafcd9f059ce50da0f55772d767b14 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Wed, 13 Nov 2024 14:35:21 -0800 Subject: [PATCH 1/5] Handle skipped trivia in the C# tokenizer Reaction to https://github.com/dotnet/roslyn/pull/75724. Will need to update to a version of Roslyn with this change to be able to test. --- .../src/Language/Legacy/RoslynCSharpTokenizer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs index 059c94d47e3..73451c18b2a 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs @@ -512,7 +512,11 @@ private StateResult Trivia() case CSharpSyntaxKind.SingleLineCommentTrivia or CSharpSyntaxKind.MultiLineCommentTrivia or CSharpSyntaxKind.MultiLineDocumentationCommentTrivia or - CSharpSyntaxKind.SingleLineDocumentationCommentTrivia: + CSharpSyntaxKind.SingleLineDocumentationCommentTrivia or + // We treat skipped tokens as comments because they're tokens that were skipped over by roslyn, + // and we want to keep them in the output so that the final C# ends up failing due to their presence. + // We also don't want them to cause loops over comments and other trivia to break. + CSharpSyntaxKind.SkippedTokensTrivia: tokenType = SyntaxKind.CSharpComment; _isOnlyWhitespaceOnLine = false; break; From 29ae702f3e412b19015a2792ffa4a6b3b59d7229 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Thu, 14 Nov 2024 10:53:24 -0800 Subject: [PATCH 2/5] Account for included newline --- .../src/Language/Legacy/RoslynCSharpTokenizer.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs index 73451c18b2a..1b0751aebe3 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RoslynCSharpTokenizer.cs @@ -509,14 +509,19 @@ private StateResult Trivia() tokenType = SyntaxKind.NewLine; _isOnlyWhitespaceOnLine = true; break; + case CSharpSyntaxKind.SkippedTokensTrivia: + // We treat skipped tokens as comments because they're tokens that were skipped over by roslyn, + // and we want to keep them in the output so that the final C# ends up failing due to their presence. + // We also don't want them to cause loops over comments and other trivia to break. + tokenType = SyntaxKind.CSharpComment; + + // SkippedTokenTrivia is used for trailing directives; they can consume the trailing newline, so we need to reset _isOnlyWhitespaceOnLine if the trivia ends with one + _isOnlyWhitespaceOnLine = triviaString.EndsWith('\n'); + break; case CSharpSyntaxKind.SingleLineCommentTrivia or CSharpSyntaxKind.MultiLineCommentTrivia or CSharpSyntaxKind.MultiLineDocumentationCommentTrivia or - CSharpSyntaxKind.SingleLineDocumentationCommentTrivia or - // We treat skipped tokens as comments because they're tokens that were skipped over by roslyn, - // and we want to keep them in the output so that the final C# ends up failing due to their presence. - // We also don't want them to cause loops over comments and other trivia to break. - CSharpSyntaxKind.SkippedTokensTrivia: + CSharpSyntaxKind.SingleLineDocumentationCommentTrivia: tokenType = SyntaxKind.CSharpComment; _isOnlyWhitespaceOnLine = false; break; From 7f8685b6cbfb6d5f3c74b702ad3c09d418705ace Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Thu, 14 Nov 2024 11:57:10 -0800 Subject: [PATCH 3/5] Update versions --- Directory.Packages.props | 14 ++++---- eng/Version.Details.xml | 76 ++++++++++++++++++++-------------------- eng/Versions.props | 38 ++++++++++---------- 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5ffff7e4760..3d16f736847 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,8 +6,8 @@ --> <_MicrosoftWebToolsPackageVersion>17.11.11-preview-0001 - <_MicrosoftVisualStudioShellPackagesVersion>17.11.39721 - <_MicrosoftVisualStudioPackagesVersion>17.11.191 + <_MicrosoftVisualStudioShellPackagesVersion>17.12.39557-preview.2.1 + <_MicrosoftVisualStudioPackagesVersion>17.12.145-preview <_VisualStudioLanguageServerProtocolVersion>17.12.1-preview <_MicrosoftExtensionsPackageVersion>8.0.0 <_BasicReferenceAssembliesVersion>1.7.2 @@ -17,7 +17,7 @@ <_RoslynDiagnosticAnalyzersPackageVersion>3.11.0-beta1.24508.2 <_MicrosoftVisualStudioLanguageServicesPackageVersion>$(MicrosoftVisualStudioLanguageServicesPackageVersion) <_XunitPackageVersion>2.6.6 - <_MicrosoftBuildPackageVersion>17.11.0-preview-24309-01 + <_MicrosoftBuildPackageVersion>17.12.0-preview-24426-07 @@ -85,14 +85,14 @@ - + - + @@ -104,12 +104,12 @@ - + - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c01e8c13c6f..8ce6f7c5c7d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,82 +11,82 @@ 1ebd9ce245112164207d961c0d2faea741c7c489 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 - + https://github.com/dotnet/roslyn - 8fc87e00bbe35131f7d3707621ae18e1af1aae55 + 826b0db12582b6b645ed1cf5e1565f767af31e53 diff --git a/eng/Versions.props b/eng/Versions.props index 5c3a2f7288c..83a1a7f5ed1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -53,25 +53,25 @@ 9.0.0-beta.24516.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 - 4.13.0-2.24554.8 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3 + 4.13.0-2.24564.3