From 1696e2aebf07da475ce71178a448071058068078 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 13 Apr 2017 11:03:38 -0700 Subject: [PATCH] Upgrade Razor's Roslyn dependency to 2.0.0. - Added C# 7 test to validate questionable features work end-to-end. - Had to add several explicit package references to let our VS specific packages work as expected. #1046 --- build/dependencies.props | 2 +- ...Microsoft.CodeAnalysis.Remote.Razor.csproj | 1 + ...VisualStudio.LanguageServices.Razor.csproj | 2 + .../CodeGenerationIntegrationTest.cs | 30 +++++++ .../CSharp7.cshtml | 43 +++++++++ .../CSharp7_DesignTime.codegen.cs | 78 ++++++++++++++++ .../CSharp7_DesignTime.ir.txt | 52 +++++++++++ .../CSharp7_DesignTime.mappings.txt | 88 +++++++++++++++++++ .../CSharp7_Runtime.codegen.cs | 81 +++++++++++++++++ .../CSharp7_Runtime.ir.txt | 49 +++++++++++ ...lStudio.LanguageServices.Razor.Test.csproj | 1 + 11 files changed, 426 insertions(+), 1 deletion(-) create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs create mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt diff --git a/build/dependencies.props b/build/dependencies.props index 86e4670399..f969c41ea6 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -8,7 +8,7 @@ 10.0.1 4.7.1 1.6.1 - 1.3.0 + 2.0.0 2.0.0-rc5-61501-05 2.0.0-* 15.0.0 diff --git a/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj b/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj index da19fe0fe0..29fe7f7b02 100644 --- a/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj +++ b/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj @@ -13,6 +13,7 @@ + diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj index 4aa18c024b..774de1e3ff 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj @@ -19,6 +19,8 @@ + + diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs index 76d51b00ff..8a732901af 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -9,6 +9,21 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests public class CodeGenerationIntegrationTest : IntegrationTestBase { #region Runtime + [Fact] + public void CSharp7_Runtime() + { + // Arrange + var engine = RazorEngine.Create(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + [Fact] public void BasicImports_Runtime() { @@ -778,6 +793,21 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests #endregion #region DesignTime + [Fact] + public void CSharp7_DesignTime() + { + // Arrange + var engine = RazorEngine.CreateDesignTime(builder => builder.Features.Add(new ApiSetsIRTestAdapter())); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertDesignTimeDocumentMatchBaseline(document); + } + [Fact] public void BasicImports_DesignTime() { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml new file mode 100644 index 0000000000..e2c134767e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml @@ -0,0 +1,43 @@ + + @{ + var nameLookup = new Dictionary() + { + ["John Doe"] = ("John", "Doe", true) + }; + + @* This is all C# 7 bits that should work. *@ + + int Sixteen = 0b0001_0000; + long BillionsAndBillions = 100_000_000_000; + double AvogadroConstant = 6.022_140_857_747_474e23; + decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + } + + @if (nameLookup.TryGetValue("John Doe", out var entry)) + { + if (entry.Extra is bool alive) + { + // Do Something + } + } +

+ Here's a very unique number: @(1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M) +

+ +
+ @((First: "John", Last: "Doe").First) @* Value Tuples *@ +
+ + @switch (entry.Extra) + { + case int age: + // Do something + break; + case IEnumerable childrenNames: + // Do more something + break; + case null: + // Do even more of something + break; + } + \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs new file mode 100644 index 0000000000..8dd033e61e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs @@ -0,0 +1,78 @@ +namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7_DesignTime + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + private static System.Object __o = null; + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + + var nameLookup = new Dictionary() + { + ["John Doe"] = ("John", "Doe", true) + }; + + + +#line default +#line hidden +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + + + int Sixteen = 0b0001_0000; + long BillionsAndBillions = 100_000_000_000; + double AvogadroConstant = 6.022_140_857_747_474e23; + decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + + +#line default +#line hidden +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + if (nameLookup.TryGetValue("John Doe", out var entry)) + { + if (entry.Extra is bool alive) + { + // Do Something + } + } + +#line default +#line hidden +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + __o = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + +#line default +#line hidden +#line 28 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + __o = (First: "John", Last: "Doe").First; + +#line default +#line hidden +#line 31 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + switch (entry.Extra) + { + case int age: + // Do something + break; + case IEnumerable childrenNames: + // Do more something + break; + case null: + // Do even more of something + break; + } + +#line default +#line hidden + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt new file mode 100644 index 0000000000..df633e2dc8 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt @@ -0,0 +1,52 @@ +Document - + Checksum - + NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles + UsingStatement - - System + UsingStatement - - System.Threading.Tasks + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7_DesignTime - - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (0:0,0 [12] CSharp7.cshtml) + RazorIRToken - (0:0,0 [6] CSharp7.cshtml) - Html - + RazorIRToken - (6:0,6 [6] CSharp7.cshtml) - Html - \n + CSharpStatement - (14:1,6 [187] CSharp7.cshtml) + RazorIRToken - (14:1,6 [187] CSharp7.cshtml) - CSharp - \n var nameLookup = new Dictionary()\n {\n ["John Doe"] = ("John", "Doe", true)\n };\n\n + CSharpStatement - (246:7,53 [253] CSharp7.cshtml) + RazorIRToken - (246:7,53 [253] CSharp7.cshtml) - CSharp - \n\n int Sixteen = 0b0001_0000;\n long BillionsAndBillions = 100_000_000_000;\n double AvogadroConstant = 6.022_140_857_747_474e23;\n decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M;\n + HtmlContent - (502:14,0 [6] CSharp7.cshtml) + RazorIRToken - (502:14,0 [6] CSharp7.cshtml) - Html - \n + CSharpStatement - (509:15,5 [159] CSharp7.cshtml) + RazorIRToken - (509:15,5 [159] CSharp7.cshtml) - CSharp - if (nameLookup.TryGetValue("John Doe", out var entry))\n {\n if (entry.Extra is bool alive)\n {\n // Do Something\n }\n } + HtmlContent - (668:21,5 [48] CSharp7.cshtml) + RazorIRToken - (668:21,5 [6] CSharp7.cshtml) - Html - \n + RazorIRToken - (674:22,4 [3] CSharp7.cshtml) - Html -

+ RazorIRToken - (677:22,7 [39] CSharp7.cshtml) - Html - \n Here's a very unique number: + CSharpExpression - (718:23,39 [62] CSharp7.cshtml) + RazorIRToken - (718:23,39 [62] CSharp7.cshtml) - CSharp - 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M + HtmlContent - (781:23,102 [33] CSharp7.cshtml) + RazorIRToken - (781:23,102 [6] CSharp7.cshtml) - Html - \n + RazorIRToken - (787:24,4 [4] CSharp7.cshtml) - Html -

+ RazorIRToken - (791:24,8 [8] CSharp7.cshtml) - Html - \n\n + RazorIRToken - (799:26,4 [5] CSharp7.cshtml) - Html -
+ RazorIRToken - (804:26,9 [10] CSharp7.cshtml) - Html - \n + CSharpExpression - (816:27,10 [34] CSharp7.cshtml) + RazorIRToken - (816:27,10 [34] CSharp7.cshtml) - CSharp - (First: "John", Last: "Doe").First + HtmlContent - (872:28,0 [18] CSharp7.cshtml) + RazorIRToken - (872:28,0 [4] CSharp7.cshtml) - Html - + RazorIRToken - (876:28,4 [6] CSharp7.cshtml) - Html -
+ RazorIRToken - (882:28,10 [8] CSharp7.cshtml) - Html - \n\n + CSharpStatement - (891:30,5 [291] CSharp7.cshtml) + RazorIRToken - (891:30,5 [291] CSharp7.cshtml) - CSharp - switch (entry.Extra)\n {\n case int age:\n // Do something\n break;\n case IEnumerable childrenNames:\n // Do more something\n break;\n case null:\n // Do even more of something\n break;\n } + HtmlContent - (1182:41,5 [9] CSharp7.cshtml) + RazorIRToken - (1182:41,5 [2] CSharp7.cshtml) - Html - \n + RazorIRToken - (1184:42,0 [7] CSharp7.cshtml) - Html - diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt new file mode 100644 index 0000000000..7ee3885089 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt @@ -0,0 +1,88 @@ +Source Location: (14:1,6 [187] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +| + var nameLookup = new Dictionary() + { + ["John Doe"] = ("John", "Doe", true) + }; + + | +Generated Location: (645:16,6 [187] ) +| + var nameLookup = new Dictionary() + { + ["John Doe"] = ("John", "Doe", true) + }; + + | + +Source Location: (246:7,53 [253] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +| + + int Sixteen = 0b0001_0000; + long BillionsAndBillions = 100_000_000_000; + double AvogadroConstant = 6.022_140_857_747_474e23; + decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + | +Generated Location: (1001:27,53 [253] ) +| + + int Sixteen = 0b0001_0000; + long BillionsAndBillions = 100_000_000_000; + double AvogadroConstant = 6.022_140_857_747_474e23; + decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + | + +Source Location: (509:15,5 [159] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +|if (nameLookup.TryGetValue("John Doe", out var entry)) + { + if (entry.Extra is bool alive) + { + // Do Something + } + }| +Generated Location: (1376:38,5 [159] ) +|if (nameLookup.TryGetValue("John Doe", out var entry)) + { + if (entry.Extra is bool alive) + { + // Do Something + } + }| + +Source Location: (718:23,39 [62] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +|1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| +Generated Location: (1691:49,39 [62] ) +|1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| + +Source Location: (816:27,10 [34] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +|(First: "John", Last: "Doe").First| +Generated Location: (1881:54,10 [34] ) +|(First: "John", Last: "Doe").First| + +Source Location: (891:30,5 [291] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) +|switch (entry.Extra) + { + case int age: + // Do something + break; + case IEnumerable childrenNames: + // Do more something + break; + case null: + // Do even more of something + break; + }| +Generated Location: (2038:59,5 [291] ) +|switch (entry.Extra) + { + case int age: + // Do something + break; + case IEnumerable childrenNames: + // Do more something + break; + case null: + // Do even more of something + break; + }| + diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs new file mode 100644 index 0000000000..8e09aa955b --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs @@ -0,0 +1,81 @@ +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "d287720a0df9d4595ed4f009c44479d9c7b0a800" +namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles +{ + #line hidden + using System; + using System.Threading.Tasks; + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7_Runtime + { + #pragma warning disable 1998 + public async System.Threading.Tasks.Task ExecuteAsync() + { + WriteLiteral("\r\n"); +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + + var nameLookup = new Dictionary() + { + ["John Doe"] = ("John", "Doe", true) + }; + + + +#line default +#line hidden +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + + + int Sixteen = 0b0001_0000; + long BillionsAndBillions = 100_000_000_000; + double AvogadroConstant = 6.022_140_857_747_474e23; + decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; + + +#line default +#line hidden + WriteLiteral("\r\n"); +#line 16 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + if (nameLookup.TryGetValue("John Doe", out var entry)) + { + if (entry.Extra is bool alive) + { + // Do Something + } + } + +#line default +#line hidden + WriteLiteral("

\r\n Here\'s a very unique number: "); +#line 24 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + Write(1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M); + +#line default +#line hidden + WriteLiteral("\r\n

\r\n\r\n
\r\n "); +#line 28 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + Write((First: "John", Last: "Doe").First); + +#line default +#line hidden + WriteLiteral(" "); + WriteLiteral("\r\n
\r\n\r\n"); +#line 31 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" + switch (entry.Extra) + { + case int age: + // Do something + break; + case IEnumerable childrenNames: + // Do more something + break; + case null: + // Do even more of something + break; + } + +#line default +#line hidden + WriteLiteral(""); + } + #pragma warning restore 1998 + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt new file mode 100644 index 0000000000..09eadf1444 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt @@ -0,0 +1,49 @@ +Document - + Checksum - + NamespaceDeclaration - - Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles + UsingStatement - - System + UsingStatement - - System.Threading.Tasks + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7_Runtime - - + RazorMethodDeclaration - - public - async - System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (0:0,0 [8] CSharp7.cshtml) + RazorIRToken - (0:0,0 [6] CSharp7.cshtml) - Html - + RazorIRToken - (6:0,6 [2] CSharp7.cshtml) - Html - \n + CSharpStatement - (8:1,0 [4] CSharp7.cshtml) + RazorIRToken - (8:1,0 [4] CSharp7.cshtml) - CSharp - + CSharpStatement - (14:1,6 [187] CSharp7.cshtml) + RazorIRToken - (14:1,6 [187] CSharp7.cshtml) - CSharp - \n var nameLookup = new Dictionary()\n {\n ["John Doe"] = ("John", "Doe", true)\n };\n\n + CSharpStatement - (246:7,53 [253] CSharp7.cshtml) + RazorIRToken - (246:7,53 [253] CSharp7.cshtml) - CSharp - \n\n int Sixteen = 0b0001_0000;\n long BillionsAndBillions = 100_000_000_000;\n double AvogadroConstant = 6.022_140_857_747_474e23;\n decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M;\n + HtmlContent - (502:14,0 [2] CSharp7.cshtml) + RazorIRToken - (502:14,0 [2] CSharp7.cshtml) - Html - \n + CSharpStatement - (504:15,0 [4] CSharp7.cshtml) + RazorIRToken - (504:15,0 [4] CSharp7.cshtml) - CSharp - + CSharpStatement - (509:15,5 [161] CSharp7.cshtml) + RazorIRToken - (509:15,5 [161] CSharp7.cshtml) - CSharp - if (nameLookup.TryGetValue("John Doe", out var entry))\n {\n if (entry.Extra is bool alive)\n {\n // Do Something\n }\n }\n + HtmlContent - (670:22,0 [46] CSharp7.cshtml) + RazorIRToken - (670:22,0 [4] CSharp7.cshtml) - Html - + RazorIRToken - (674:22,4 [3] CSharp7.cshtml) - Html -

+ RazorIRToken - (677:22,7 [39] CSharp7.cshtml) - Html - \n Here's a very unique number: + CSharpExpression - (718:23,39 [62] CSharp7.cshtml) + RazorIRToken - (718:23,39 [62] CSharp7.cshtml) - CSharp - 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M + HtmlContent - (781:23,102 [33] CSharp7.cshtml) + RazorIRToken - (781:23,102 [6] CSharp7.cshtml) - Html - \n + RazorIRToken - (787:24,4 [4] CSharp7.cshtml) - Html -

+ RazorIRToken - (791:24,8 [8] CSharp7.cshtml) - Html - \n\n + RazorIRToken - (799:26,4 [5] CSharp7.cshtml) - Html -
+ RazorIRToken - (804:26,9 [2] CSharp7.cshtml) - Html - \n + RazorIRToken - (806:27,0 [8] CSharp7.cshtml) - Html - + CSharpExpression - (816:27,10 [34] CSharp7.cshtml) + RazorIRToken - (816:27,10 [34] CSharp7.cshtml) - CSharp - (First: "John", Last: "Doe").First + HtmlContent - (851:27,45 [1] CSharp7.cshtml) + RazorIRToken - (851:27,45 [1] CSharp7.cshtml) - Html - + HtmlContent - (870:27,64 [16] CSharp7.cshtml) + RazorIRToken - (870:27,64 [6] CSharp7.cshtml) - Html - \n + RazorIRToken - (876:28,4 [6] CSharp7.cshtml) - Html -
+ RazorIRToken - (882:28,10 [4] CSharp7.cshtml) - Html - \n\n + CSharpStatement - (886:30,0 [4] CSharp7.cshtml) + RazorIRToken - (886:30,0 [4] CSharp7.cshtml) - CSharp - + CSharpStatement - (891:30,5 [293] CSharp7.cshtml) + RazorIRToken - (891:30,5 [293] CSharp7.cshtml) - CSharp - switch (entry.Extra)\n {\n case int age:\n // Do something\n break;\n case IEnumerable childrenNames:\n // Do more something\n break;\n case null:\n // Do even more of something\n break;\n }\n + HtmlContent - (1184:42,0 [7] CSharp7.cshtml) + RazorIRToken - (1184:42,0 [7] CSharp7.cshtml) - Html - diff --git a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj index 4850409fd2..8646f856a9 100644 --- a/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj +++ b/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj @@ -26,6 +26,7 @@ +