diff --git a/build/artifacts.props b/build/artifacts.props
index 0ae964e727fe..001be2727540 100644
--- a/build/artifacts.props
+++ b/build/artifacts.props
@@ -151,9 +151,7 @@
-
-
@@ -184,9 +182,6 @@
-
-
-
diff --git a/src/Razor/NuGetPackageVerifier.json b/src/Razor/NuGetPackageVerifier.json
index b62352e8b910..a6b622a7e434 100644
--- a/src/Razor/NuGetPackageVerifier.json
+++ b/src/Razor/NuGetPackageVerifier.json
@@ -5,12 +5,7 @@
],
"packages": {
"Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources": {},
- "RazorPageGenerator": {},
- "Microsoft.CodeAnalysis.Razor.Workspaces": {},
- "Microsoft.CodeAnalysis.Remote.Razor": {},
- "Microsoft.VisualStudio.Editor.Razor": {},
- "Microsoft.VisualStudio.LanguageServices.Razor": {},
- "Microsoft.VisualStudio.Mac.LanguageServices.Razor": {}
+ "RazorPageGenerator": {}
}
},
"Default": { // Rules to run for packages not listed in any other set.
diff --git a/src/Razor/Razor.sln b/src/Razor/Razor.sln
index 5bb3137be261..b4446df80626 100644
--- a/src/Razor/Razor.sln
+++ b/src/Razor/Razor.sln
@@ -31,24 +31,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Runtime.Test", "test\Microsoft.AspNetCore.Razor.Runtime.Test\Microsoft.AspNetCore.Razor.Runtime.Test.csproj", "{277AB67E-9C8D-4799-A18C-C628E70A8664}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces", "src\Microsoft.CodeAnalysis.Razor.Workspaces\Microsoft.CodeAnalysis.Razor.Workspaces.csproj", "{0F265874-C592-448B-BC4F-3430AB03E0DC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Razor", "src\Microsoft.CodeAnalysis.Remote.Razor\Microsoft.CodeAnalysis.Remote.Razor.csproj", "{4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tooling", "tooling", "{C0CC1E1F-1559-44DE-93A8-63259CEA2AAB}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.RazorExtension", "tooling\Microsoft.VisualStudio.RazorExtension\Microsoft.VisualStudio.RazorExtension.csproj", "{D66B45B5-CBFD-4947-81F1-F30AB80EA992}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor", "src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj", "{42403DAF-F0BC-4F3A-B7F2-46D7013345D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Test", "test\Microsoft.CodeAnalysis.Razor.Test\Microsoft.CodeAnalysis.Razor.Test.csproj", "{7A8A1664-37CE-4376-81CA-1862CF5F91D9}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Razor", "src\Microsoft.VisualStudio.LanguageServices.Razor\Microsoft.VisualStudio.LanguageServices.Razor.csproj", "{E5D92DB7-5CBF-410A-9685-FF76F71EC96F}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPageGenerator.Test", "test\RazorPageGenerator.Test\RazorPageGenerator.Test.csproj", "{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Razor.Test", "test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj", "{37E61BDB-658E-4F44-A499-D64CC6D35485}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions", "src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj", "{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj", "{7CFD5646-A757-4498-9E01-9C8528ED60AE}"
@@ -57,38 +45,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim", "test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj", "{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces.Test", "test\Microsoft.CodeAnalysis.Razor.Workspaces.Test\Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj", "{C61AAE12-5007-4205-A220-68F354A7F235}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X", "src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.csproj", "{F1538809-7347-45D2-A7AC-C1D89CF0BBD4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test.csproj", "{296D4516-0323-4D28-955D-B0324E4F10BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X", "test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj", "{AC5CA24B-B81E-4B20-B193-2E3983B1896C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor", "src\Microsoft.VisualStudio.Editor.Razor\Microsoft.VisualStudio.Editor.Razor.csproj", "{0BCDE75A-A438-46C7-95E9-391F029D07C5}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor.Test", "test\Microsoft.VisualStudio.Editor.Razor.Test\Microsoft.VisualStudio.Editor.Razor.Test.csproj", "{AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor.Test.Common", "test\Microsoft.VisualStudio.Editor.Razor.Test.Common\Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj", "{FC684D4F-D23C-407C-9C68-E10EF3B38560}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.RazorAddin", "tooling\Microsoft.VisualStudio.Mac.RazorAddin\Microsoft.VisualStudio.Mac.RazorAddin.csproj", "{FAF9986F-E086-4513-9D52-F7BF5FFCF31D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.LanguageServices.Razor", "src\Microsoft.VisualStudio.Mac.LanguageServices.Razor\Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj", "{95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test", "test\Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test\Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj", "{B8A3E4CA-D54A-441F-A3BF-E00F060CA042}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design", "src\Microsoft.AspNetCore.Razor.Design\Microsoft.AspNetCore.Razor.Design.csproj", "{5257B25D-330A-4DCF-ACED-B4709CFBF916}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.csproj", "{1D90F276-E1CA-4FDF-A173-EB889E7D3150}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test", "test\Microsoft.AspNetCore.Razor.Test\Microsoft.AspNetCore.Razor.Test.csproj", "{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Performance", "benchmarks\Microsoft.AspNetCore.Razor.Performance\Microsoft.AspNetCore.Razor.Performance.csproj", "{6205467F-E381-4C42-AEEC-763BD62B3D5E}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{C2C98051-0F39-47F2-80B6-E72B29159F2C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common", "test\Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common\Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj", "{933101DA-C4CC-401A-AA01-2784E1025B7F}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Tools", "src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj", "{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor", "src\Microsoft.NET.Sdk.Razor\Microsoft.NET.Sdk.Razor.csproj", "{7D9ECCEE-71D1-4A42-ABEE-876AFA1B4FC9}"
@@ -153,28 +121,6 @@ Global
{277AB67E-9C8D-4799-A18C-C628E70A8664}.Release|Any CPU.Build.0 = Release|Any CPU
{277AB67E-9C8D-4799-A18C-C628E70A8664}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{277AB67E-9C8D-4799-A18C-C628E70A8664}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.Release|Any CPU.Build.0 = Release|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {0F265874-C592-448B-BC4F-3430AB03E0DC}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Release|Any CPU.Build.0 = Release|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Release|Any CPU.Build.0 = Release|Any CPU
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -191,14 +137,6 @@ Global
{7A8A1664-37CE-4376-81CA-1862CF5F91D9}.Release|Any CPU.Build.0 = Release|Any CPU
{7A8A1664-37CE-4376-81CA-1862CF5F91D9}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{7A8A1664-37CE-4376-81CA-1862CF5F91D9}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Release|Any CPU.Build.0 = Release|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -207,14 +145,6 @@ Global
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Release|Any CPU.Build.0 = Release|Any CPU
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.Release|Any CPU.Build.0 = Release|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {37E61BDB-658E-4F44-A499-D64CC6D35485}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -247,14 +177,6 @@ Global
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Release|Any CPU.Build.0 = Release|Any CPU
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.Release|Any CPU.Build.0 = Release|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -279,54 +201,6 @@ Global
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Release|Any CPU.Build.0 = Release|Any CPU
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Release|Any CPU.Build.0 = Release|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {0BCDE75A-A438-46C7-95E9-391F029D07C5}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Release|Any CPU.Build.0 = Release|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Release|Any CPU.Build.0 = Release|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {FC684D4F-D23C-407C-9C68-E10EF3B38560}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Release|Any CPU.Build.0 = Release|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Release|Any CPU.Build.0 = Release|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Release|Any CPU.Build.0 = Release|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{5257B25D-330A-4DCF-ACED-B4709CFBF916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5257B25D-330A-4DCF-ACED-B4709CFBF916}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5257B25D-330A-4DCF-ACED-B4709CFBF916}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -351,22 +225,6 @@ Global
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Release|Any CPU.Build.0 = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.Build.0 = Release|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.Release|Any CPU.Build.0 = Release|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
- {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
@@ -410,33 +268,19 @@ Global
{932F3C9C-A6C0-40D3-BA50-9309886242FC} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{969357A4-CCF1-46D9-B002-9AA072AFC75C} = {92463391-81BE-462B-AC3C-78C6C760741F}
{277AB67E-9C8D-4799-A18C-C628E70A8664} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {0F265874-C592-448B-BC4F-3430AB03E0DC} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
- {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
- {D66B45B5-CBFD-4947-81F1-F30AB80EA992} = {C0CC1E1F-1559-44DE-93A8-63259CEA2AAB}
{42403DAF-F0BC-4F3A-B7F2-46D7013345D8} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{7A8A1664-37CE-4376-81CA-1862CF5F91D9} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {E5D92DB7-5CBF-410A-9685-FF76F71EC96F} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {37E61BDB-658E-4F44-A499-D64CC6D35485} = {92463391-81BE-462B-AC3C-78C6C760741F}
{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F}
{078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {92463391-81BE-462B-AC3C-78C6C760741F}
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {C61AAE12-5007-4205-A220-68F354A7F235} = {92463391-81BE-462B-AC3C-78C6C760741F}
{F1538809-7347-45D2-A7AC-C1D89CF0BBD4} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{296D4516-0323-4D28-955D-B0324E4F10BE} = {92463391-81BE-462B-AC3C-78C6C760741F}
{AC5CA24B-B81E-4B20-B193-2E3983B1896C} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {0BCDE75A-A438-46C7-95E9-391F029D07C5} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
- {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {FC684D4F-D23C-407C-9C68-E10EF3B38560} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {FAF9986F-E086-4513-9D52-F7BF5FFCF31D} = {C0CC1E1F-1559-44DE-93A8-63259CEA2AAB}
- {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
- {B8A3E4CA-D54A-441F-A3BF-E00F060CA042} = {92463391-81BE-462B-AC3C-78C6C760741F}
{5257B25D-330A-4DCF-ACED-B4709CFBF916} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{1D90F276-E1CA-4FDF-A173-EB889E7D3150} = {92463391-81BE-462B-AC3C-78C6C760741F}
{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8} = {92463391-81BE-462B-AC3C-78C6C760741F}
- {6205467F-E381-4C42-AEEC-763BD62B3D5E} = {C2C98051-0F39-47F2-80B6-E72B29159F2C}
- {933101DA-C4CC-401A-AA01-2784E1025B7F} = {92463391-81BE-462B-AC3C-78C6C760741F}
{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{7D9ECCEE-71D1-4A42-ABEE-876AFA1B4FC9} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
{6EA56B2B-89EC-4C38-A384-97D203375B06} = {92463391-81BE-462B-AC3C-78C6C760741F}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs
deleted file mode 100644
index 32248e0d1b0a..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs
+++ /dev/null
@@ -1 +0,0 @@
-[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs
deleted file mode 100644
index c35e1db42f8b..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using BenchmarkDotNet.Attributes;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class CodeGenerationBenchmark
- {
- public CodeGenerationBenchmark()
- {
- var current = new DirectoryInfo(AppContext.BaseDirectory);
- while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml")))
- {
- current = current.Parent;
- }
-
- var root = current;
- var fileSystem = RazorProjectFileSystem.Create(root.FullName);
-
- ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ;
-
- MSN = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"));
- }
-
- public RazorProjectEngine ProjectEngine { get; }
-
- public RazorProjectItem MSN { get; }
-
- [Benchmark(Description = "Razor Design Time Code Generation of MSN.com")]
- public void CodeGeneration_DesignTime_LargeStaticFile()
- {
- var codeDocument = ProjectEngine.ProcessDesignTime(MSN);
- var generated = codeDocument.GetCSharpDocument();
-
- if (generated.Diagnostics.Count != 0)
- {
- throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics));
- }
- }
-
- [Benchmark(Description = "Razor Runtime Code Generation of MSN.com")]
- public void CodeGeneration_Runtime_LargeStaticFile()
- {
- var codeDocument = ProjectEngine.Process(MSN);
- var generated = codeDocument.GetCSharpDocument();
-
- if (generated.Diagnostics.Count != 0)
- {
- throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics));
- }
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml
deleted file mode 100644
index 7b3d7a3a08f1..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml
+++ /dev/null
@@ -1,3983 +0,0 @@
-
-
-
-
-
-
-
- MSN.com - Hotmail, Outlook, Skype, Bing, Latest News, Photos & Videos
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Get your mail here
-
- - See your recent emails
- - Send a quick email
- - Manage your calendar with easy access
-
-
-
Sign in with any Microsoft account: Outlook, Hotmail, MSN, Live
-
What is a Microsoft account?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Skype on MSN
-
- - See who's online
- - Notifications and missed messages
- - Voice calls and chats
-
-
-
Start connecting your Skype
-
Connecting Skype with MSN requires a Microsoft account to get set up.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Get your latest feed from Facebook
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Send Feedback
-
-
-
-
-
-
-
-
- I'm having problems with Top Destinations
- I'm having issues searching
- I'm having problems with Featured Apps
- I see an error in the content
- Other
-
-
-
-
-
-
-
-
-
-
-
-
Please give an overall site rating:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj
deleted file mode 100644
index ab0ec8c6fccc..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
- netcoreapp2.1
- Exe
- true
- true
- false
-
-
-
-
-
-
-
-
-
- Serialization\%(FileName)%(Extension)
-
-
- TestServices\%(FileName)%(Extension)
-
-
- TestServices\%(FileName)%(Extension)
-
-
- TestServices\%(FileName)%(Extension)
-
-
- TestServices\%(FileName)%(Extension)
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs
deleted file mode 100644
index 40b903844b07..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/BackgroundCodeGenerationBenchmark.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using BenchmarkDotNet.Attributes;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class BackgroundCodeGenerationBenchmark : ProjectSnapshotManagerBenchmarkBase
- {
- [IterationSetup]
- public void Setup()
- {
- SnapshotManager = CreateProjectSnapshotManager();
- SnapshotManager.HostProjectAdded(HostProject);
- SnapshotManager.Changed += SnapshotManager_Changed;
- }
-
- [IterationCleanup]
- public void Cleanup()
- {
- SnapshotManager.Changed -= SnapshotManager_Changed;
-
- Tasks.Clear();
- }
-
- private List Tasks { get; } = new List();
-
- private DefaultProjectSnapshotManager SnapshotManager { get; set; }
-
- [Benchmark(Description = "Generates the code for 100 files", OperationsPerInvoke = 100)]
- public async Task BackgroundCodeGeneration_Generate100Files()
- {
- for (var i = 0; i < Documents.Length; i++)
- {
- SnapshotManager.DocumentAdded(HostProject, Documents[i], TextLoaders[i % 4]);
- }
-
- await Task.WhenAll(Tasks);
- }
-
- private void SnapshotManager_Changed(object sender, ProjectChangeEventArgs e)
- {
- // The real work happens here.
- var project = SnapshotManager.GetLoadedProject(e.ProjectFilePath);
- var document = project.GetDocument(e.DocumentFilePath);
-
- Tasks.Add(document.GetGeneratedOutputAsync());
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs
deleted file mode 100644
index 58baba8faf8b..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectLoadBenchmark.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using BenchmarkDotNet.Attributes;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class ProjectLoadBenchmark : ProjectSnapshotManagerBenchmarkBase
- {
- [IterationSetup]
- public void Setup()
- {
- SnapshotManager = CreateProjectSnapshotManager();
- }
-
- private DefaultProjectSnapshotManager SnapshotManager { get; set; }
-
- [Benchmark(Description = "Initializes a project and 100 files", OperationsPerInvoke = 100)]
- public void ProjectLoad_AddProjectAnd100Files()
- {
- SnapshotManager.HostProjectAdded(HostProject);
-
- for (var i= 0; i < Documents.Length; i++)
- {
- SnapshotManager.DocumentAdded(HostProject, Documents[i], TextLoaders[i % 4]);
- }
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs
deleted file mode 100644
index 70590a6a35a7..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.LanguageServices.Razor.Serialization;
-using Newtonsoft.Json;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class ProjectSnapshotManagerBenchmarkBase
- {
- public ProjectSnapshotManagerBenchmarkBase()
- {
- var current = new DirectoryInfo(AppContext.BaseDirectory);
- while (current != null && !File.Exists(Path.Combine(current.FullName, "Razor.sln")))
- {
- current = current.Parent;
- }
-
- var root = current;
- var projectRoot = Path.Combine(root.FullName, "test", "testapps", "LargeProject");
-
- HostProject = new HostProject(Path.Combine(projectRoot, "LargeProject.csproj"), FallbackRazorConfiguration.MVC_2_1);
-
- TextLoaders = new TextLoader[4];
- for (var i = 0; i < 4; i++)
- {
- var filePath = Path.Combine(projectRoot, "Views", "Home", $"View00{i % 4}.cshtml");
- var text = SourceText.From(filePath, encoding: null);
- TextLoaders[i] = TextLoader.From(TextAndVersion.Create(text, VersionStamp.Create()));
- }
-
- Documents = new HostDocument[100];
- for (var i = 0; i < Documents.Length; i++)
- {
- var filePath = Path.Combine(projectRoot, "Views", "Home", $"View00{i % 4}.cshtml");
- Documents[i] = new HostDocument(filePath, $"/Views/Home/View00{i}.cshtml");
- }
-
- var tagHelpers = Path.Combine(root.FullName, "benchmarks", "Microsoft.AspNetCore.Razor.Performance", "taghelpers.json");
- TagHelperResolver = new StaticTagHelperResolver(ReadTagHelpers(tagHelpers));
- }
-
- internal HostProject HostProject { get; }
-
- internal HostDocument[] Documents { get; }
-
- internal TextLoader[] TextLoaders { get; }
-
- internal TagHelperResolver TagHelperResolver { get; }
-
- internal DefaultProjectSnapshotManager CreateProjectSnapshotManager()
- {
- var services = TestServices.Create(
- new IWorkspaceService[]
- {
- new StaticProjectSnapshotProjectEngineFactory(),
- },
- new ILanguageService[]
- {
- TagHelperResolver,
- });
-
- return new DefaultProjectSnapshotManager(
- new TestForegroundDispatcher(),
- new TestErrorReporter(),
- Array.Empty(),
- new AdhocWorkspace(services));
- }
-
- private static IReadOnlyList ReadTagHelpers(string filePath)
- {
- var serializer = new JsonSerializer();
- serializer.Converters.Add(new RazorDiagnosticJsonConverter());
- serializer.Converters.Add(new TagHelperDescriptorJsonConverter());
-
- using (var reader = new JsonTextReader(File.OpenText(filePath)))
- {
- return serializer.Deserialize>(reader);
- }
- }
-
- private class TestForegroundDispatcher : ForegroundDispatcher
- {
- public override bool IsForegroundThread => true;
-
- public override TaskScheduler ForegroundScheduler => TaskScheduler.Default;
-
- public override TaskScheduler BackgroundScheduler => TaskScheduler.Default;
- }
-
- private class TestErrorReporter : ErrorReporter
- {
- public override void ReportError(Exception exception)
- {
- }
-
- public override void ReportError(Exception exception, ProjectSnapshot project)
- {
- }
-
- public override void ReportError(Exception exception, Project workspaceProject)
- {
- }
- }
-
- private class StaticTagHelperResolver : TagHelperResolver
- {
- private readonly IReadOnlyList _tagHelpers;
-
- public StaticTagHelperResolver(IReadOnlyList tagHelpers)
- {
- this._tagHelpers = tagHelpers;
- }
-
- public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default)
- {
- return Task.FromResult(new TagHelperResolutionResult(_tagHelpers, Array.Empty()));
- }
- }
-
- private class StaticProjectSnapshotProjectEngineFactory : ProjectSnapshotProjectEngineFactory
- {
- public override RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure)
- {
- return RazorProjectEngine.Create(project.Configuration, fileSystem, b =>
- {
- RazorExtensions.Register(b);
- });
- }
-
- public override IProjectEngineFactory FindFactory(ProjectSnapshot project)
- {
- throw new NotImplementedException();
- }
-
- public override IProjectEngineFactory FindSerializableFactory(ProjectSnapshot project)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/SyntaxTreeGenerationBenckmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/SyntaxTreeGenerationBenckmark.cs
deleted file mode 100644
index d1ec9a0a559f..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/SyntaxTreeGenerationBenckmark.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using System.Linq;
-using BenchmarkDotNet.Attributes;
-using Microsoft.AspNetCore.Mvc.Razor.Extensions;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class SyntaxTreeGenerationBenchmark
- {
- public SyntaxTreeGenerationBenchmark()
- {
- var current = new DirectoryInfo(AppContext.BaseDirectory);
- while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml")))
- {
- current = current.Parent;
- }
-
- var root = current;
- var fileSystem = RazorProjectFileSystem.Create(root.FullName);
-
- ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ;
-
- var projectItem = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml"));
- MSN = RazorSourceDocument.ReadFrom(projectItem);
-
- var directiveFeature = ProjectEngine.EngineFeatures.OfType().FirstOrDefault();
- Directives = directiveFeature?.Directives.ToArray() ?? Array.Empty();
- }
-
- public RazorProjectEngine ProjectEngine { get; }
-
- public RazorSourceDocument MSN { get; }
-
- public DirectiveDescriptor[] Directives { get; }
-
- [Benchmark(Description = "Razor Design Time Syntax Tree Generation of MSN.com")]
- public void SyntaxTreeGeneration_DesignTime_LargeStaticFile()
- {
- var options = RazorParserOptions.CreateDesignTime(o =>
- {
- foreach (var directive in Directives)
- {
- o.Directives.Add(directive);
- }
- });
- var syntaxTree = RazorSyntaxTree.Parse(MSN, options);
-
- if (syntaxTree.Diagnostics.Count != 0)
- {
- throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics));
- }
- }
-
- [Benchmark(Description = "Razor Runtime Syntax Tree Generation of MSN.com")]
- public void SyntaxTreeGeneration_Runtime_LargeStaticFile()
- {
- var options = RazorParserOptions.Create(o =>
- {
- foreach (var directive in Directives)
- {
- o.Directives.Add(directive);
- }
- });
- var syntaxTree = RazorSyntaxTree.Parse(MSN, options);
-
- if (syntaxTree.Diagnostics.Count != 0)
- {
- throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics));
- }
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs
deleted file mode 100644
index f1dcabe64092..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using BenchmarkDotNet.Attributes;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.VisualStudio.LanguageServices.Razor.Serialization;
-using Newtonsoft.Json;
-
-namespace Microsoft.AspNetCore.Razor.Performance
-{
- public class TagHelperSerializationBenchmark
- {
- private readonly byte[] _tagHelperBuffer;
-
- public TagHelperSerializationBenchmark()
- {
- var current = new DirectoryInfo(AppContext.BaseDirectory);
- while (current != null && !File.Exists(Path.Combine(current.FullName, "taghelpers.json")))
- {
- current = current.Parent;
- }
-
- var tagHelperFilePath = Path.Combine(current.FullName, "taghelpers.json");
- _tagHelperBuffer = File.ReadAllBytes(tagHelperFilePath);
- }
-
- [Benchmark(Description = "Razor TagHelper Serialization")]
- public void TagHelper_Serialization_RoundTrip()
- {
- var serializer = new JsonSerializer();
- serializer.Converters.Add(new RazorDiagnosticJsonConverter());
- serializer.Converters.Add(new TagHelperDescriptorJsonConverter());
-
- // Deserialize from json file.
- IReadOnlyList tagHelpers;
- using (var stream = new MemoryStream(_tagHelperBuffer))
- using (var reader = new JsonTextReader(new StreamReader(stream)))
- {
- tagHelpers = serializer.Deserialize>(reader);
- }
-
- // Serialize back to json.
- using (var stream = new MemoryStream())
- using (var writer = new StreamWriter(stream, Encoding.UTF8, bufferSize: 4096))
- {
- serializer.Serialize(writer, tagHelpers);
- }
- }
- }
-}
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md
deleted file mode 100644
index 38ce0ff71a02..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Compile the solution in Release mode (so binaries are available in release)
-
-To run a specific benchmark add it as parameter.
-```
-dotnet run -c Release
-```
-
-If you run without any parameters, you'll be offered the list of all benchmarks and get to choose.
-```
-dotnet run -c Release
-```
\ No newline at end of file
diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json
deleted file mode 100644
index 27dcb160389e..000000000000
--- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper","TagMatchingRules":[{"TagName":"*","Attributes":[{"Name":"asp-prerender-module","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-prerender-module","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.SpaServices","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-prerender-module","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.ModuleName","Diagnostics":[],"Metadata":{"Common.PropertyName":"ModuleName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-prerender-export","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.ExportName","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExportName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-prerender-data","IndexerNamePrefix":null,"TypeName":"System.Object","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"object Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.CustomDataParameter","Diagnostics":[],"Metadata":{"Common.PropertyName":"CustomDataParameter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-prerender-timeout","IndexerNamePrefix":null,"TypeName":"System.Int32","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"int Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.TimeoutMillisecondsParameter","Diagnostics":[],"Metadata":{"Common.PropertyName":"TimeoutMillisecondsParameter"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper","TagMatchingRules":[{"TagName":"a","Attributes":[{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-host","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-host","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-protocol","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-protocol","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-protocol","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Protocol","Diagnostics":[],"Metadata":{"Common.PropertyName":"Protocol"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-host","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Host","Diagnostics":[],"Metadata":{"Common.PropertyName":"Host"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper","TagMatchingRules":[{"TagName":"cache","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"priority","IndexerNamePrefix":null,"TypeName":"Microsoft.Extensions.Caching.Memory.CacheItemPriority?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.Extensions.Caching.Memory.CacheItemPriority? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.Priority","Diagnostics":[],"Metadata":{"Common.PropertyName":"Priority"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryBy","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryBy"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-header","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByHeader","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByHeader"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-query","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByQuery","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByQuery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByRoute","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByRoute"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-cookie","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByCookie","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByCookie"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"vary-by-user","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByUser","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByUser"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-on","IndexerNamePrefix":null,"TypeName":"System.DateTimeOffset?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.DateTimeOffset? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresOn","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresOn"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-after","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresAfter","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresAfter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-sliding","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresSliding","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresSliding"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"enabled","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.Enabled","Diagnostics":[],"Metadata":{"Common.PropertyName":"Enabled"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper","TagMatchingRules":[{"TagName":"distributed-cache","Attributes":[{"Name":"name","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"name","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"name","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.Name","Diagnostics":[],"Metadata":{"Common.PropertyName":"Name"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryBy","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryBy"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-header","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByHeader","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByHeader"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-query","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByQuery","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByQuery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByRoute","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByRoute"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-cookie","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByCookie","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByCookie"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"vary-by-user","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByUser","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByUser"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-on","IndexerNamePrefix":null,"TypeName":"System.DateTimeOffset?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.DateTimeOffset? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresOn","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresOn"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-after","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresAfter","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresAfter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-sliding","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresSliding","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresSliding"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"enabled","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.Enabled","Diagnostics":[],"Metadata":{"Common.PropertyName":"Enabled"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper","TagMatchingRules":[{"TagName":"environment","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"names","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Names","Diagnostics":[],"Metadata":{"Common.PropertyName":"Names"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Include","Diagnostics":[],"Metadata":{"Common.PropertyName":"Include"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Exclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"Exclude"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper","TagMatchingRules":[{"TagName":"button","Attributes":[{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper","TagMatchingRules":[{"TagName":"form","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-antiforgery","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Antiforgery","Diagnostics":[],"Metadata":{"Common.PropertyName":"Antiforgery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"method","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Method","Diagnostics":[],"Metadata":{"Common.PropertyName":"Method"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper","TagMatchingRules":[{"TagName":"img","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false},{"Name":"src","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper.Src","Diagnostics":[],"Metadata":{"Common.PropertyName":"Src"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper","TagMatchingRules":[{"TagName":"input","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-format","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Format","Diagnostics":[],"Metadata":{"Common.PropertyName":"Format"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"type","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.InputTypeName","Diagnostics":[],"Metadata":{"Common.PropertyName":"InputTypeName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Value","Diagnostics":[],"Metadata":{"Common.PropertyName":"Value"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper","TagMatchingRules":[{"TagName":"label","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper","TagMatchingRules":[{"TagName":"link","Attributes":[{"Name":"asp-href-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-href-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-href-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-href-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-class","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-class","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-property","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-property","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-value","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-value","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"href","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.Href","Diagnostics":[],"Metadata":{"Common.PropertyName":"Href"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-href-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.HrefInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"HrefInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-href-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.HrefExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"HrefExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHref","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHref"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHrefInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHrefExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHrefExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-class","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestClass","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestClass"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-property","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestProperty","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestProperty"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestValue","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestValue"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper","TagMatchingRules":[{"TagName":"option","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper.Value","Diagnostics":[],"Metadata":{"Common.PropertyName":"Value"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper","TagMatchingRules":[{"TagName":"form","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper","TagMatchingRules":[{"TagName":"script","Attributes":[{"Name":"asp-src-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-src-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-src-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-src-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-test","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.Src","Diagnostics":[],"Metadata":{"Common.PropertyName":"Src"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-src-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.SrcInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"SrcInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-src-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.SrcExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"SrcExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrc","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrc"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrcInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrcInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrcExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrcExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackTestExpression","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestExpression"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper","TagMatchingRules":[{"TagName":"select","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"select","Attributes":[{"Name":"asp-items","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-items","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-items","IndexerNamePrefix":null,"TypeName":"System.Collections.Generic.IEnumerable","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Collections.Generic.IEnumerable Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper.Items","Diagnostics":[],"Metadata":{"Common.PropertyName":"Items"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper","TagMatchingRules":[{"TagName":"textarea","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper","TagMatchingRules":[{"TagName":"span","Attributes":[{"Name":"asp-validation-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-validation-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-validation-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper","TagMatchingRules":[{"TagName":"div","Attributes":[{"Name":"asp-validation-summary","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-validation-summary","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":true,"IsStringProperty":false,"Name":"asp-validation-summary","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper.ValidationSummary","Diagnostics":[],"Metadata":{"Common.PropertyName":"ValidationSummary"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","TagMatchingRules":[{"TagName":"body","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","TagMatchingRules":[{"TagName":"head","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper","TagMatchingRules":[{"TagName":"*","Attributes":[{"Name":"itemid","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"itemid","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"applet","Attributes":[{"Name":"archive","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"archive","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"area","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"audio","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"base","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"blockquote","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"formaction","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"formaction","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"del","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"embed","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"form","Attributes":[{"Name":"action","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"html","Attributes":[{"Name":"manifest","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"manifest","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"iframe","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"img","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"img","Attributes":[{"Name":"srcset","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"srcset","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"formaction","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"formaction","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"ins","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"menuitem","Attributes":[{"Name":"icon","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"icon","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"object","Attributes":[{"Name":"archive","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"archive","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"object","Attributes":[{"Name":"data","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"q","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"source","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"source","Attributes":[{"Name":"srcset","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"srcset","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"track","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"video","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"video","Attributes":[{"Name":"poster","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"poster","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper"},"HasErrors":false}]
\ No newline at end of file
diff --git a/src/Razor/build.cmd b/src/Razor/build.cmd
new file mode 100644
index 000000000000..f4169ea5e411
--- /dev/null
+++ b/src/Razor/build.cmd
@@ -0,0 +1,3 @@
+@ECHO OFF
+SET RepoRoot="%~dp0..\.."
+%RepoRoot%\build.cmd -LockFile %RepoRoot%\korebuild-lock.txt -Path %~dp0 %*
diff --git a/src/Razor/build.sh b/src/Razor/build.sh
new file mode 100644
index 000000000000..d5bb0cf6312d
--- /dev/null
+++ b/src/Razor/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+repo_root="$DIR/../.."
+"$repo_root/build.sh" --path "$DIR" --lockfile "$repo_root/korebuild-lock.txt" "$@"
diff --git a/src/Razor/build/repo.targets b/src/Razor/build/repo.targets
index 550069ec4773..5311efc415fd 100644
--- a/src/Razor/build/repo.targets
+++ b/src/Razor/build/repo.targets
@@ -1,7 +1,4 @@
-
-
-
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs
index 7214d8bacabc..1a87602ce228 100644
--- a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs
@@ -2,24 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.GenerateTool, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Language.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.TagHelperTool, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("rzc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj
index e67f36e02f5e..8e48f98549e1 100644
--- a/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj
+++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj
@@ -1,4 +1,4 @@
-
+
Razor is a markup syntax for adding server-side logic to web pages. This assembly contains infrastructure supporting Razor MSBuild integration.
@@ -12,15 +12,6 @@
false
-
-
- Shared\TagHelperDescriptorJsonConverter.cs
-
-
- Shared\RazorDiagnosticJsonConverter.cs
-
-
-
diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorDiagnosticJsonConverter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/RazorDiagnosticJsonConverter.cs
similarity index 100%
rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorDiagnosticJsonConverter.cs
rename to src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/RazorDiagnosticJsonConverter.cs
diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/TagHelperDescriptorJsonConverter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/TagHelperDescriptorJsonConverter.cs
similarity index 100%
rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/TagHelperDescriptorJsonConverter.cs
rename to src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/TagHelperDescriptorJsonConverter.cs
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs
deleted file mode 100644
index ff200966e826..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal class DefaultErrorReporter : ErrorReporter
- {
- public override void ReportError(Exception exception)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- // Do nothing.
- }
-
- public override void ReportError(Exception exception, ProjectSnapshot project)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- // Do nothing.
- }
-
- public override void ReportError(Exception exception, Project workspaceProject)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- // Do nothing.
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs
deleted file mode 100644
index e9c987d10895..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- [Shared]
- [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Default)]
- internal class DefaultErrorReporterFactory : IWorkspaceServiceFactory
- {
- public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
- {
- return new DefaultErrorReporter();
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs
deleted file mode 100644
index cd9ac1ee5104..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal class DefaultProjectSnapshotProjectEngineFactory : ProjectSnapshotProjectEngineFactory
- {
- private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_1;
-
- private readonly IFallbackProjectEngineFactory _fallback;
- private readonly Lazy[] _factories;
-
- public DefaultProjectSnapshotProjectEngineFactory(
- IFallbackProjectEngineFactory fallback,
- Lazy[] factories)
- {
- if (fallback == null)
- {
- throw new ArgumentNullException(nameof(fallback));
- }
-
- if (factories == null)
- {
- throw new ArgumentNullException(nameof(factories));
- }
-
- _fallback = fallback;
- _factories = factories;
- }
-
- public override RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (fileSystem == null)
- {
- throw new ArgumentNullException(nameof(fileSystem));
- }
-
- // When we're running in the editor, the editor provides a configure delegate that will include
- // the editor settings and tag helpers.
- //
- // This service is only used in process in Visual Studio, and any other callers should provide these
- // things also.
- configure = configure ?? ((b) => { });
-
- // The default configuration currently matches the newest MVC configuration.
- //
- // We typically want this because the language adds features over time - we don't want to a bunch of errors
- // to show up when a document is first opened, and then go away when the configuration loads, we'd prefer the opposite.
- var configuration = project.Configuration ?? DefaultConfiguration;
-
- // If there's no factory to handle the configuration then fall back to a very basic configuration.
- //
- // This will stop a crash from happening in this case (misconfigured project), but will still make
- // it obvious to the user that something is wrong.
- var factory = SelectFactory(configuration) ?? _fallback;
- return factory.Create(configuration, fileSystem, configure);
- }
-
- public override IProjectEngineFactory FindFactory(ProjectSnapshot project)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- return SelectFactory(project.Configuration ?? DefaultConfiguration, requireSerializable: false);
- }
-
- public override IProjectEngineFactory FindSerializableFactory(ProjectSnapshot project)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- return SelectFactory(project.Configuration ?? DefaultConfiguration, requireSerializable: true);
- }
-
- private IProjectEngineFactory SelectFactory(RazorConfiguration configuration, bool requireSerializable = false)
- {
- for (var i = 0; i < _factories.Length; i++)
- {
- var factory = _factories[i];
- if (string.Equals(configuration.ConfigurationName, factory.Metadata.ConfigurationName))
- {
- return requireSerializable && !factory.Metadata.SupportsSerialization ? null : factory.Value;
- }
- }
-
- return null;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactoryFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactoryFactory.cs
deleted file mode 100644
index 663bd8f2bc66..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactoryFactory.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-
-namespace Microsoft.CodeAnalysis.Razor.Workspaces
-{
- [ExportWorkspaceServiceFactory(typeof(ProjectSnapshotProjectEngineFactory))]
- internal class DefaultProjectSnapshotProjectEngineFactoryFactory : IWorkspaceServiceFactory
- {
- private readonly IFallbackProjectEngineFactory _fallback;
- private readonly Lazy[] _factories;
-
- [ImportingConstructor]
- public DefaultProjectSnapshotProjectEngineFactoryFactory(
- IFallbackProjectEngineFactory fallback,
- [ImportMany] Lazy[] factories)
- {
- if (fallback == null)
- {
- throw new ArgumentNullException(nameof(fallback));
- }
-
- if (factories == null)
- {
- throw new ArgumentNullException(nameof(factories));
- }
-
- _fallback = fallback;
- _factories = factories;
- }
-
- public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
- {
- if (workspaceServices == null)
- {
- throw new ArgumentNullException(nameof(workspaceServices));
- }
-
- return new DefaultProjectSnapshotProjectEngineFactory(_fallback, _factories);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs
deleted file mode 100644
index eba3c12e2568..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Composition;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-using Microsoft.Extensions.Internal;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- // Deliberately not exported for now, until this feature is working end to end.
- // [Export(typeof(ProjectSnapshotChangeTrigger))]
- internal class BackgroundDocumentGenerator : ProjectSnapshotChangeTrigger
- {
- private ForegroundDispatcher _foregroundDispatcher;
- private ProjectSnapshotManagerBase _projectManager;
-
- private readonly Dictionary _files;
- private Timer _timer;
-
- [ImportingConstructor]
- public BackgroundDocumentGenerator(ForegroundDispatcher foregroundDispatcher)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
-
- _files = new Dictionary();
- }
-
- public bool HasPendingNotifications
- {
- get
- {
- lock (_files)
- {
- return _files.Count > 0;
- }
- }
- }
-
- // Used in unit tests to control the timer delay.
- public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(2);
-
- public bool IsScheduledOrRunning => _timer != null;
-
- // Used in unit tests to ensure we can control when background work starts.
- public ManualResetEventSlim BlockBackgroundWorkStart { get; set; }
-
- // Used in unit tests to ensure we can know when background work finishes.
- public ManualResetEventSlim NotifyBackgroundWorkStarting { get; set; }
-
- // Used in unit tests to ensure we can know when background has captured its current workload.
- public ManualResetEventSlim NotifyBackgroundCapturedWorkload { get; set; }
-
- // Used in unit tests to ensure we can control when background work completes.
- public ManualResetEventSlim BlockBackgroundWorkCompleting { get; set; }
-
- // Used in unit tests to ensure we can know when background work finishes.
- public ManualResetEventSlim NotifyBackgroundWorkCompleted { get; set; }
-
- private void OnStartingBackgroundWork()
- {
- if (BlockBackgroundWorkStart != null)
- {
- BlockBackgroundWorkStart.Wait();
- BlockBackgroundWorkStart.Reset();
- }
-
- if (NotifyBackgroundWorkStarting != null)
- {
- NotifyBackgroundWorkStarting.Set();
- }
- }
-
- private void OnCompletingBackgroundWork()
- {
- if (BlockBackgroundWorkCompleting != null)
- {
- BlockBackgroundWorkCompleting.Wait();
- BlockBackgroundWorkCompleting.Reset();
- }
- }
-
- private void OnCompletedBackgroundWork()
- {
- if (NotifyBackgroundWorkCompleted != null)
- {
- NotifyBackgroundWorkCompleted.Set();
- }
- }
-
- private void OnBackgroundCapturedWorkload()
- {
- if (NotifyBackgroundCapturedWorkload != null)
- {
- NotifyBackgroundCapturedWorkload.Set();
- }
- }
-
- public override void Initialize(ProjectSnapshotManagerBase projectManager)
- {
- if (projectManager == null)
- {
- throw new ArgumentNullException(nameof(projectManager));
- }
-
- _projectManager = projectManager;
- _projectManager.Changed += ProjectManager_Changed;
- }
-
- protected virtual Task ProcessDocument(DocumentSnapshot document)
- {
- return document.GetGeneratedOutputAsync();
- }
-
- public void Enqueue(ProjectSnapshot project, DocumentSnapshot document)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (_files)
- {
- // We only want to store the last 'seen' version of any given document. That way when we pick one to process
- // it's always the best version to use.
- _files[new DocumentKey(project.FilePath, document.FilePath)] = document;
-
- StartWorker();
- }
- }
-
- protected virtual void StartWorker()
- {
- // Access to the timer is protected by the lock in Enqueue and in Timer_Tick
- if (_timer == null)
- {
-
- // Timer will fire after a fixed delay, but only once.
- _timer = NonCapturingTimer.Create(state => ((BackgroundDocumentGenerator)state).Timer_Tick(), this, Delay, Timeout.InfiniteTimeSpan);
- }
- }
-
- private void Timer_Tick()
- {
- _ = TimerTick();
- }
-
- private async Task TimerTick()
- {
- try
- {
- _foregroundDispatcher.AssertBackgroundThread();
-
- // Timer is stopped.
- _timer.Change(Timeout.Infinite, Timeout.Infinite);
-
- OnStartingBackgroundWork();
-
- DocumentSnapshot[] work;
- lock (_files)
- {
- work = _files.Values.ToArray();
- _files.Clear();
- }
-
- OnBackgroundCapturedWorkload();
-
- for (var i = 0; i < work.Length; i++)
- {
- var document = work[i];
- try
- {
- await ProcessDocument(document);
- }
- catch (Exception ex)
- {
- ReportError(document, ex);
- }
- }
-
- OnCompletingBackgroundWork();
-
- lock (_files)
- {
- // Resetting the timer allows another batch of work to start.
- _timer.Dispose();
- _timer = null;
-
- // If more work came in while we were running start the worker again.
- if (_files.Count > 0)
- {
- StartWorker();
- }
- }
-
- OnCompletedBackgroundWork();
- }
- catch (Exception ex)
- {
- // This is something totally unexpected, let's just send it over to the workspace.
- await Task.Factory.StartNew(
- (p) => ((ProjectSnapshotManagerBase)p).ReportError(ex),
- _projectManager,
- CancellationToken.None,
- TaskCreationOptions.None,
- _foregroundDispatcher.ForegroundScheduler);
- }
- }
-
- private void ReportError(DocumentSnapshot document, Exception ex)
- {
- GC.KeepAlive(Task.Factory.StartNew(
- (p) => ((ProjectSnapshotManagerBase)p).ReportError(ex),
- _projectManager,
- CancellationToken.None,
- TaskCreationOptions.None,
- _foregroundDispatcher.ForegroundScheduler));
- }
-
- private void ProjectManager_Changed(object sender, ProjectChangeEventArgs e)
- {
- switch (e.Kind)
- {
- case ProjectChangeKind.ProjectAdded:
- case ProjectChangeKind.ProjectChanged:
- {
- var project = _projectManager.GetLoadedProject(e.ProjectFilePath);
- foreach (var documentFilePath in project.DocumentFilePaths)
- {
- Enqueue(project, project.GetDocument(documentFilePath));
- }
-
- break;
- }
-
- case ProjectChangeKind.ProjectRemoved:
- // ignore
- break;
-
- case ProjectChangeKind.DocumentAdded:
- case ProjectChangeKind.DocumentChanged:
- {
- var project = _projectManager.GetLoadedProject(e.ProjectFilePath);
- Enqueue(project, project.GetDocument(e.DocumentFilePath));
-
- break;
- }
-
-
- case ProjectChangeKind.DocumentRemoved:
- // ignore
- break;
-
- default:
- throw new InvalidOperationException($"Unknown ProjectChangeKind {e.Kind}");
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentKey.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentKey.cs
deleted file mode 100644
index 2fe707a7071a..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentKey.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.Extensions.Internal;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- public struct DocumentKey : IEquatable
- {
- public DocumentKey(string projectFilePath, string documentFilePath)
- {
- ProjectFilePath = projectFilePath;
- DocumentFilePath = documentFilePath;
- }
-
- public string ProjectFilePath { get; }
-
- public string DocumentFilePath { get; }
-
- public bool Equals(DocumentKey other)
- {
- return
- FilePathComparer.Instance.Equals(ProjectFilePath, other.ProjectFilePath) &&
- FilePathComparer.Instance.Equals(DocumentFilePath, other.DocumentFilePath);
- }
-
- public override bool Equals(object obj)
- {
- return obj is DocumentKey key ? Equals(key) : false;
- }
-
- public override int GetHashCode()
- {
- var hash = new HashCodeCombiner();
- hash.Add(ProjectFilePath, FilePathComparer.Instance);
- hash.Add(DocumentFilePath, FilePathComparer.Instance);
- return hash;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs
deleted file mode 100644
index 113238a878ce..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright(c) .NET Foundation.All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.Extensions.Internal;
-
-namespace Microsoft.CodeAnalysis.Razor.Editor
-{
- public sealed class EditorSettings : IEquatable
- {
- public static readonly EditorSettings Default = new EditorSettings(indentWithTabs: false, indentSize: 4);
-
- public EditorSettings(bool indentWithTabs, int indentSize)
- {
- if (indentSize < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(indentSize));
- }
-
- IndentWithTabs = indentWithTabs;
- IndentSize = indentSize;
- }
-
- public bool IndentWithTabs { get; }
-
- public int IndentSize { get; }
-
- public bool Equals(EditorSettings other)
- {
- if (other == null)
- {
- return false;
- }
-
- return IndentWithTabs == other.IndentWithTabs &&
- IndentSize == other.IndentSize;
- }
-
- public override bool Equals(object other)
- {
- return Equals(other as EditorSettings);
- }
-
- public override int GetHashCode()
- {
- var combiner = HashCodeCombiner.Start();
- combiner.Add(IndentWithTabs);
- combiner.Add(IndentSize);
-
- return combiner.CombinedHash;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs
deleted file mode 100644
index 573d56654a44..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.CodeAnalysis.Razor.Editor
-{
- public sealed class EditorSettingsChangedEventArgs : EventArgs
- {
- public EditorSettingsChangedEventArgs(EditorSettings settings)
- {
- Settings = settings;
- }
-
- public EditorSettings Settings { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs
deleted file mode 100644
index 6736dfc39d94..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor.Editor
-{
- internal abstract class WorkspaceEditorSettings : ILanguageService
- {
- public abstract event EventHandler Changed;
-
- public abstract EditorSettings Current { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs
deleted file mode 100644
index 4f0b0dab818e..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal abstract class ErrorReporter : IWorkspaceService
- {
- public abstract void ReportError(Exception exception);
-
- public abstract void ReportError(Exception exception, ProjectSnapshot project);
-
- public abstract void ReportError(Exception exception, Project workspaceProject);
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs
deleted file mode 100644
index 923cb0a66ec3..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- [MetadataAttribute]
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
- public class ExportCustomProjectEngineFactoryAttribute : ExportAttribute, ICustomProjectEngineFactoryMetadata
- {
- public ExportCustomProjectEngineFactoryAttribute(string configurationName)
- : base(typeof(IProjectEngineFactory))
- {
- if (configurationName == null)
- {
- throw new ArgumentNullException(nameof(configurationName));
- }
-
- ConfigurationName = configurationName;
- }
-
- public string ConfigurationName { get; }
-
- public bool SupportsSerialization { get; set; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs
deleted file mode 100644
index 855acedde25c..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- [Export(typeof(IFallbackProjectEngineFactory))]
- internal class FallbackProjectEngineFactory : IFallbackProjectEngineFactory
- {
- public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure)
- {
- if (configuration == null)
- {
- throw new ArgumentNullException(nameof(configuration));
- }
-
- if (fileSystem == null)
- {
- throw new ArgumentNullException(nameof(fileSystem));
- }
-
- // This is a very basic implementation that will provide reasonable support without crashing.
- // If the user falls into this situation, ideally they can realize that something is wrong and take
- // action.
- //
- // This has no support for:
- // - Tag Helpers
- // - Imports
- // - Default Imports
- // - and will have a very limited set of directives
- return RazorProjectEngine.Create(configuration, fileSystem, configure);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs
deleted file mode 100644
index bf9b0f59a49c..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal abstract class ForegroundDispatcher
- {
- public abstract bool IsForegroundThread { get; }
-
- public abstract TaskScheduler ForegroundScheduler { get; }
-
- public abstract TaskScheduler BackgroundScheduler { get; }
-
- public virtual void AssertForegroundThread([CallerMemberName] string caller = null)
- {
- if (!IsForegroundThread)
- {
- caller = caller == null ? Workspaces.Resources.ForegroundDispatcher_NoMethodNamePlaceholder : $"'{caller}'";
- throw new InvalidOperationException(Workspaces.Resources.FormatForegroundDispatcher_AssertForegroundThread(caller));
- }
- }
-
- public virtual void AssertBackgroundThread([CallerMemberName] string caller = null)
- {
- if (IsForegroundThread)
- {
- caller = caller == null ? Workspaces.Resources.ForegroundDispatcher_NoMethodNamePlaceholder : $"'{caller}'";
- throw new InvalidOperationException(Workspaces.Resources.FormatForegroundDispatcher_AssertBackgroundThread(caller));
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs
deleted file mode 100644
index 3f93a6e60523..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- public interface ICustomProjectEngineFactoryMetadata
- {
- string ConfigurationName { get; }
-
- bool SupportsSerialization { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs
deleted file mode 100644
index ccdc1b80c16c..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- // Used to create the 'fallback' project engine when we don't have a custom implementation.
- internal interface IFallbackProjectEngineFactory : IProjectEngineFactory
- {
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs
deleted file mode 100644
index 903c47842b21..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- public interface IProjectEngineFactory
- {
- RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure);
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj
deleted file mode 100644
index ca09c13e7865..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure.
- net46;netstandard2.0
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs
deleted file mode 100644
index cf2341878dfd..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal abstract class ProjectSnapshotProjectEngineFactory : IWorkspaceService
- {
- public abstract IProjectEngineFactory FindFactory(ProjectSnapshot project);
-
- public abstract IProjectEngineFactory FindSerializableFactory(ProjectSnapshot project);
-
- public RazorProjectEngine Create(ProjectSnapshot project)
- {
- return Create(project, RazorProjectFileSystem.Create(Path.GetDirectoryName(project.FilePath)), null);
- }
-
- public RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (fileSystem == null)
- {
- throw new ArgumentNullException(nameof(fileSystem));
- }
-
- return Create(project, fileSystem, null);
- }
-
- public RazorProjectEngine Create(ProjectSnapshot project, Action configure)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- return Create(project, RazorProjectFileSystem.Create(Path.GetDirectoryName(project.FilePath)), configure);
- }
-
- public abstract RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure);
-
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs
deleted file mode 100644
index d25b38ddbe45..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class DefaultDocumentSnapshot : DocumentSnapshot
- {
- public DefaultDocumentSnapshot(DefaultProjectSnapshot project, DocumentState state)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- Project = project;
- State = state;
- }
-
- public DefaultProjectSnapshot Project { get; }
-
- public DocumentState State { get; }
-
- public override string FilePath => State.HostDocument.FilePath;
-
- public override string TargetPath => State.HostDocument.TargetPath;
-
- public override IReadOnlyList GetImports()
- {
- return State.Imports.GetImports(Project, this);
- }
-
- public override Task GetTextAsync()
- {
- return State.GetTextAsync();
- }
-
- public override Task GetTextVersionAsync()
- {
- return State.GetTextVersionAsync();
- }
-
- public override Task GetGeneratedOutputAsync()
- {
- // IMPORTANT: Don't put more code here. We want this to return a cached task.
- return State.GeneratedOutput.GetGeneratedOutputInitializationTask(Project, this);
- }
-
- public override bool TryGetText(out SourceText result)
- {
- return State.TryGetText(out result);
- }
-
- public override bool TryGetTextVersion(out VersionStamp result)
- {
- return State.TryGetTextVersion(out result);
- }
-
- public override bool TryGetGeneratedOutput(out RazorCodeDocument result)
- {
- if (State.GeneratedOutput.IsResultAvailable)
- {
- result = State.GeneratedOutput.GetGeneratedOutputInitializationTask(Project, this).Result;
- return true;
- }
-
- result = null;
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs
deleted file mode 100644
index aba5e7a9163e..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class DefaultProjectSnapshot : ProjectSnapshot
- {
- private readonly object _lock;
-
- private Dictionary _documents;
-
- public DefaultProjectSnapshot(ProjectState state)
- {
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- State = state;
-
- _lock = new object();
- _documents = new Dictionary(FilePathComparer.Instance);
- }
-
- public ProjectState State { get; }
-
- public override RazorConfiguration Configuration => HostProject.Configuration;
-
- public override IEnumerable DocumentFilePaths => State.Documents.Keys;
-
- public override string FilePath => State.HostProject.FilePath;
-
- public HostProject HostProject => State.HostProject;
-
- public override bool IsInitialized => WorkspaceProject != null;
-
- public override VersionStamp Version => State.Version;
-
- public override Project WorkspaceProject => State.WorkspaceProject;
-
- public override DocumentSnapshot GetDocument(string filePath)
- {
- lock (_lock)
- {
- if (!_documents.TryGetValue(filePath, out var result) &&
- State.Documents.TryGetValue(filePath, out var state))
- {
- result = new DefaultDocumentSnapshot(this, state);
- _documents.Add(filePath, result);
- }
-
- return result;
- }
- }
-
- public override RazorProjectEngine GetProjectEngine()
- {
- return State.ProjectEngine.GetProjectEngine(this);
- }
-
- public override Task> GetTagHelpersAsync()
- {
- // IMPORTANT: Don't put more code here. We want this to return a cached task.
- return State.TagHelpers.GetTagHelperInitializationTask(this);
- }
-
- public override bool TryGetTagHelpers(out IReadOnlyList result)
- {
- if (State.TagHelpers.IsResultAvailable)
- {
- result = State.TagHelpers.GetTagHelperInitializationTask(this).Result;
- return true;
- }
-
- result = null;
- return false;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs
deleted file mode 100644
index 5a810cc80396..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs
+++ /dev/null
@@ -1,656 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- // The implementation of project snapshot manager abstracts over the Roslyn Project (WorkspaceProject)
- // and information from the host's underlying project system (HostProject), to provide a unified and
- // immutable view of the underlying project systems.
- //
- // The HostProject support all of the configuration that the Razor SDK exposes via the project system
- // (language version, extensions, named configuration).
- //
- // The WorkspaceProject is needed to support our use of Roslyn Compilations for Tag Helpers and other
- // C# based constructs.
- //
- // The implementation will create a ProjectSnapshot for each HostProject. Put another way, when we
- // see a WorkspaceProject get created, we only care if we already have a HostProject for the same
- // filepath.
- //
- // Our underlying HostProject infrastructure currently does not handle multiple TFMs (project with
- // $(TargetFrameworks), so we just bind to the first WorkspaceProject we see for each HostProject.
- internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase
- {
- public override event EventHandler Changed;
-
- private readonly ErrorReporter _errorReporter;
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly ProjectSnapshotChangeTrigger[] _triggers;
-
- // Each entry holds a ProjectState and an optional ProjectSnapshot. ProjectSnapshots are
- // created lazily.
- private readonly Dictionary _projects;
- private readonly HashSet _openDocuments;
-
- public DefaultProjectSnapshotManager(
- ForegroundDispatcher foregroundDispatcher,
- ErrorReporter errorReporter,
- IEnumerable triggers,
- Workspace workspace)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (errorReporter == null)
- {
- throw new ArgumentNullException(nameof(errorReporter));
- }
-
- if (triggers == null)
- {
- throw new ArgumentNullException(nameof(triggers));
- }
-
- if (workspace == null)
- {
- throw new ArgumentNullException(nameof(workspace));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _errorReporter = errorReporter;
- _triggers = triggers.ToArray();
- Workspace = workspace;
-
- _projects = new Dictionary(FilePathComparer.Instance);
- _openDocuments = new HashSet(FilePathComparer.Instance);
-
- for (var i = 0; i < _triggers.Length; i++)
- {
- _triggers[i].Initialize(this);
- }
- }
-
- public override IReadOnlyList Projects
- {
- get
- {
- _foregroundDispatcher.AssertForegroundThread();
-
-
- var i = 0;
- var projects = new ProjectSnapshot[_projects.Count];
- foreach (var entry in _projects)
- {
- if (entry.Value.Snapshot == null)
- {
- entry.Value.Snapshot = new DefaultProjectSnapshot(entry.Value.State);
- }
-
- projects[i++] = entry.Value.Snapshot;
- }
-
- return projects;
- }
- }
-
- public override Workspace Workspace { get; }
-
- public override ProjectSnapshot GetLoadedProject(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_projects.TryGetValue(filePath, out var entry))
- {
- if (entry.Snapshot == null)
- {
- entry.Snapshot = new DefaultProjectSnapshot(entry.State);
- }
-
- return entry.Snapshot;
- }
-
- return null;
- }
-
- public override ProjectSnapshot GetOrCreateProject(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- return GetLoadedProject(filePath) ?? new EphemeralProjectSnapshot(Workspace.Services, filePath);
- }
-
- public override bool IsDocumentOpen(string documentFilePath)
- {
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- return _openDocuments.Contains(documentFilePath);
- }
-
- public override void DocumentAdded(HostProject hostProject, HostDocument document, TextLoader textLoader)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_projects.TryGetValue(hostProject.FilePath, out var entry))
- {
- var loader = textLoader == null ? DocumentState.EmptyLoader : (Func>)(() =>
- {
- return textLoader.LoadTextAndVersionAsync(Workspace, null, CancellationToken.None);
- });
- var state = entry.State.WithAddedHostDocument(document, loader);
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[hostProject.FilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, document.FilePath, ProjectChangeKind.DocumentAdded));
- }
- }
- }
-
- public override void DocumentRemoved(HostProject hostProject, HostDocument document)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
- if (_projects.TryGetValue(hostProject.FilePath, out var entry))
- {
- var state = entry.State.WithRemovedHostDocument(document);
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[hostProject.FilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, document.FilePath, ProjectChangeKind.DocumentRemoved));
- }
- }
- }
-
- public override void DocumentOpened(string projectFilePath, string documentFilePath, SourceText sourceText)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- if (sourceText == null)
- {
- throw new ArgumentNullException(nameof(sourceText));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
- if (_projects.TryGetValue(projectFilePath, out var entry) &&
- entry.State.Documents.TryGetValue(documentFilePath, out var older))
- {
- ProjectState state;
- SourceText olderText;
- VersionStamp olderVersion;
-
- var currentText = sourceText;
- if (older.TryGetText(out olderText) &&
- older.TryGetTextVersion(out olderVersion))
- {
- var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion();
- state = entry.State.WithChangedHostDocument(older.HostDocument, currentText, version);
- }
- else
- {
- state = entry.State.WithChangedHostDocument(older.HostDocument, async () =>
- {
- olderText = await older.GetTextAsync().ConfigureAwait(false);
- olderVersion = await older.GetTextVersionAsync().ConfigureAwait(false);
-
- var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion();
- return TextAndVersion.Create(currentText, version, documentFilePath);
- });
- }
-
- _openDocuments.Add(documentFilePath);
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[projectFilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged));
- }
- }
- }
-
- public override void DocumentClosed(string projectFilePath, string documentFilePath, TextLoader textLoader)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- if (textLoader == null)
- {
- throw new ArgumentNullException(nameof(textLoader));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
- if (_projects.TryGetValue(projectFilePath, out var entry) &&
- entry.State.Documents.TryGetValue(documentFilePath, out var older))
- {
- var state = entry.State.WithChangedHostDocument(older.HostDocument, async () =>
- {
- return await textLoader.LoadTextAndVersionAsync(Workspace, default, default);
- });
-
- _openDocuments.Remove(documentFilePath);
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[projectFilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged));
- }
- }
- }
-
- public override void DocumentChanged(string projectFilePath, string documentFilePath, SourceText sourceText)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- if (sourceText == null)
- {
- throw new ArgumentNullException(nameof(sourceText));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
- if (_projects.TryGetValue(projectFilePath, out var entry) &&
- entry.State.Documents.TryGetValue(documentFilePath, out var older))
- {
- ProjectState state;
- SourceText olderText;
- VersionStamp olderVersion;
-
- var currentText = sourceText;
- if (older.TryGetText(out olderText) &&
- older.TryGetTextVersion(out olderVersion))
- {
- var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion();
- state = entry.State.WithChangedHostDocument(older.HostDocument, currentText, version);
- }
- else
- {
- state = entry.State.WithChangedHostDocument(older.HostDocument, async () =>
- {
- olderText = await older.GetTextAsync().ConfigureAwait(false);
- olderVersion = await older.GetTextVersionAsync().ConfigureAwait(false);
-
- var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion();
- return TextAndVersion.Create(currentText, version, documentFilePath);
- });
- }
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[projectFilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged));
- }
- }
- }
-
- public override void DocumentChanged(string projectFilePath, string documentFilePath, TextLoader textLoader)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- if (textLoader == null)
- {
- throw new ArgumentNullException(nameof(textLoader));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
- if (_projects.TryGetValue(projectFilePath, out var entry) &&
- entry.State.Documents.TryGetValue(documentFilePath, out var older))
- {
- var state = entry.State.WithChangedHostDocument(older.HostDocument, async () =>
- {
- return await textLoader.LoadTextAndVersionAsync(Workspace, default, default);
- });
-
- // Document updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[projectFilePath] = new Entry(state);
- NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged));
- }
- }
- }
-
- public override void HostProjectAdded(HostProject hostProject)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- // We don't expect to see a HostProject initialized multiple times for the same path. Just ignore it.
- if (_projects.ContainsKey(hostProject.FilePath))
- {
- return;
- }
-
- // It's possible that Workspace has already created a project for this, but it's not deterministic
- // So if possible find a WorkspaceProject.
- var workspaceProject = GetWorkspaceProject(hostProject.FilePath);
-
- var state = ProjectState.Create(Workspace.Services, hostProject, workspaceProject);
- _projects[hostProject.FilePath] = new Entry(state);
-
- // We need to notify listeners about every project add.
- NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectAdded));
- }
-
- public override void HostProjectChanged(HostProject hostProject)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_projects.TryGetValue(hostProject.FilePath, out var entry))
- {
- var state = entry.State.WithHostProject(hostProject);
-
- // HostProject updates can no-op.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[hostProject.FilePath] = new Entry(state);
-
- NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectChanged));
- }
- }
- }
-
- public override void HostProjectRemoved(HostProject hostProject)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_projects.TryGetValue(hostProject.FilePath, out var snapshot))
- {
- _projects.Remove(hostProject.FilePath);
-
- // We need to notify listeners about every project removal.
- NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectRemoved));
- }
- }
-
- public override void WorkspaceProjectAdded(Project workspaceProject)
- {
- if (workspaceProject == null)
- {
- throw new ArgumentNullException(nameof(workspaceProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (!IsSupportedWorkspaceProject(workspaceProject))
- {
- return;
- }
-
- // The WorkspaceProject initialization never triggers a "Project Add" from out point of view, we
- // only care if the new WorkspaceProject matches an existing HostProject.
- if (_projects.TryGetValue(workspaceProject.FilePath, out var entry))
- {
- // If this is a multi-targeting project then we are only interested in a single workspace project. If we already
- // found one in the past just ignore this one.
- if (entry.State.WorkspaceProject == null)
- {
- var state = entry.State.WithWorkspaceProject(workspaceProject);
- _projects[workspaceProject.FilePath] = new Entry(state);
-
- NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged));
- }
- }
- }
-
- public override void WorkspaceProjectChanged(Project workspaceProject)
- {
- if (workspaceProject == null)
- {
- throw new ArgumentNullException(nameof(workspaceProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (!IsSupportedWorkspaceProject(workspaceProject))
- {
- return;
- }
-
- // We also need to check the projectId here. If this is a multi-targeting project then we are only interested
- // in a single workspace project. Just use the one that showed up first.
- if (_projects.TryGetValue(workspaceProject.FilePath, out var entry) &&
- (entry.State.WorkspaceProject == null || entry.State.WorkspaceProject.Id == workspaceProject.Id) &&
- (entry.State.WorkspaceProject == null || entry.State.WorkspaceProject.Version.GetNewerVersion(workspaceProject.Version) == workspaceProject.Version))
- {
- var state = entry.State.WithWorkspaceProject(workspaceProject);
-
- // WorkspaceProject updates can no-op. This can be the case if a build is triggered, but we've
- // already seen the update.
- if (!object.ReferenceEquals(state, entry.State))
- {
- _projects[workspaceProject.FilePath] = new Entry(state);
-
- NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged));
- }
- }
- }
-
- public override void WorkspaceProjectRemoved(Project workspaceProject)
- {
- if (workspaceProject == null)
- {
- throw new ArgumentNullException(nameof(workspaceProject));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (!IsSupportedWorkspaceProject(workspaceProject))
- {
- return;
- }
-
- if (_projects.TryGetValue(workspaceProject.FilePath, out var entry))
- {
- // We also need to check the projectId here. If this is a multi-targeting project then we are only interested
- // in a single workspace project. Make sure the WorkspaceProject we're using is the one that's being removed.
- if (entry.State.WorkspaceProject?.Id != workspaceProject.Id)
- {
- return;
- }
-
- ProjectState state;
-
- // So if the WorkspaceProject got removed, we should double check to make sure that there aren't others
- // hanging around. This could happen if a project is multi-targeting and one of the TFMs is removed.
- var otherWorkspaceProject = GetWorkspaceProject(workspaceProject.FilePath);
- if (otherWorkspaceProject != null && otherWorkspaceProject.Id != workspaceProject.Id)
- {
- // OK there's another WorkspaceProject, use that.
- state = entry.State.WithWorkspaceProject(otherWorkspaceProject);
- _projects[otherWorkspaceProject.FilePath] = new Entry(state);
-
- NotifyListeners(new ProjectChangeEventArgs(otherWorkspaceProject.FilePath, ProjectChangeKind.ProjectChanged));
- }
- else
- {
- state = entry.State.WithWorkspaceProject(null);
- _projects[workspaceProject.FilePath] = new Entry(state);
-
- // Notify listeners of a change because we've removed computed state.
- NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged));
- }
- }
- }
-
- public override void ReportError(Exception exception)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- _errorReporter.ReportError(exception);
- }
-
- public override void ReportError(Exception exception, ProjectSnapshot project)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- _errorReporter.ReportError(exception, project);
- }
-
- public override void ReportError(Exception exception, HostProject hostProject)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- var snapshot = hostProject?.FilePath == null ? null : GetLoadedProject(hostProject.FilePath);
- _errorReporter.ReportError(exception, snapshot);
- }
-
- public override void ReportError(Exception exception, Project workspaceProject)
- {
- if (exception == null)
- {
- throw new ArgumentNullException(nameof(exception));
- }
-
- _errorReporter.ReportError(exception, workspaceProject);
- }
-
- // We're only interested in CSharp projects that have a FilePath. We rely on the FilePath to
- // unify the Workspace Project with our HostProject concept.
- private bool IsSupportedWorkspaceProject(Project workspaceProject) => workspaceProject.Language == LanguageNames.CSharp && workspaceProject.FilePath != null;
-
- private Project GetWorkspaceProject(string filePath)
- {
- var solution = Workspace.CurrentSolution;
- if (solution == null)
- {
- return null;
- }
-
- foreach (var workspaceProject in solution.Projects)
- {
- if (IsSupportedWorkspaceProject(workspaceProject) &&
- FilePathComparer.Instance.Equals(filePath, workspaceProject.FilePath))
- {
- // We don't try to handle mulitple TFMs anwhere in Razor, just take the first WorkspaceProject that is a match.
- return workspaceProject;
- }
- }
-
- return null;
- }
-
- // virtual so it can be overridden in tests
- protected virtual void NotifyListeners(ProjectChangeEventArgs e)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- var handler = Changed;
- if (handler != null)
- {
- handler(this, e);
- }
- }
-
- private class Entry
- {
- public ProjectSnapshot Snapshot;
- public readonly ProjectState State;
-
- public Entry(ProjectState state)
- {
- State = state;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs
deleted file mode 100644
index b092174aa697..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(ProjectSnapshotManager), RazorLanguage.Name)]
- internal class DefaultProjectSnapshotManagerFactory : ILanguageServiceFactory
- {
- private readonly IEnumerable _triggers;
- private readonly ForegroundDispatcher _foregroundDispatcher;
-
- [ImportingConstructor]
- public DefaultProjectSnapshotManagerFactory(
- ForegroundDispatcher foregroundDispatcher,
- [ImportMany] IEnumerable triggers)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (triggers == null)
- {
- throw new ArgumentNullException(nameof(triggers));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _triggers = triggers;
- }
-
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- return new DefaultProjectSnapshotManager(
- _foregroundDispatcher,
- languageServices.WorkspaceServices.GetRequiredService(),
- _triggers,
- languageServices.WorkspaceServices.Workspace);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs
deleted file mode 100644
index a3e11da04fa9..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.Extensions.Internal;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class DocumentGeneratedOutputTracker
- {
- private readonly object _lock;
-
- private DocumentGeneratedOutputTracker _older;
- private Task _task;
-
- private IReadOnlyList _tagHelpers;
- private IReadOnlyList _imports;
-
- public DocumentGeneratedOutputTracker(DocumentGeneratedOutputTracker older)
- {
- _older = older;
-
- _lock = new object();
- }
-
- public bool IsResultAvailable => _task?.IsCompleted == true;
-
- public DocumentGeneratedOutputTracker Older => _older;
-
- public Task GetGeneratedOutputInitializationTask(ProjectSnapshot project, DocumentSnapshot document)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- if (_task == null)
- {
- lock (_lock)
- {
- if (_task == null)
- {
- _task = GetGeneratedOutputInitializationTaskCore(project, document);
- }
- }
- }
-
- return _task;
- }
-
- public DocumentGeneratedOutputTracker Fork()
- {
- return new DocumentGeneratedOutputTracker(this);
- }
-
- private async Task GetGeneratedOutputInitializationTaskCore(ProjectSnapshot project, DocumentSnapshot document)
- {
- var tagHelpers = await project.GetTagHelpersAsync().ConfigureAwait(false);
- var imports = await GetImportsAsync(project, document);
-
- if (_older != null && _older.IsResultAvailable)
- {
- var tagHelperDifference = new HashSet(TagHelperDescriptorComparer.Default);
- tagHelperDifference.UnionWith(_older._tagHelpers);
- tagHelperDifference.SymmetricExceptWith(tagHelpers);
-
- var importDifference = new HashSet();
- importDifference.UnionWith(_older._imports);
- importDifference.SymmetricExceptWith(imports);
-
- if (tagHelperDifference.Count == 0 && importDifference.Count == 0)
- {
- // We can use the cached result.
- var result = _older._task.Result;
-
- // Drop reference so it can be GC'ed
- _older = null;
-
- // Cache the tag helpers and imports so the next version can use them
- _tagHelpers = tagHelpers;
- _imports = imports;
-
- return result;
- }
- }
-
- // Drop reference so it can be GC'ed
- _older = null;
-
- // Cache the tag helpers and imports so the next version can use them
- _tagHelpers = tagHelpers;
- _imports = imports;
-
- var importSources = new List();
- foreach (var item in imports)
- {
- var sourceDocument = await GetRazorSourceDocumentAsync(item.Import);
- importSources.Add(sourceDocument);
- }
-
- var documentSource = await GetRazorSourceDocumentAsync(document);
-
- var projectEngine = project.GetProjectEngine();
-
- return projectEngine.ProcessDesignTime(documentSource, importSources, tagHelpers);
- }
-
- private async Task GetRazorSourceDocumentAsync(DocumentSnapshot document)
- {
- var sourceText = await document.GetTextAsync();
-
- return sourceText.GetRazorSourceDocument(document.FilePath);
- }
-
- private async Task> GetImportsAsync(ProjectSnapshot project, DocumentSnapshot document)
- {
- var imports = new List();
- foreach (var snapshot in document.GetImports())
- {
- var versionStamp = await snapshot.GetTextVersionAsync();
- imports.Add(new ImportItem(snapshot.FilePath, versionStamp, snapshot));
- }
-
- return imports;
- }
-
- private struct ImportItem : IEquatable
- {
- public ImportItem(string filePath, VersionStamp versionStamp, DocumentSnapshot import)
- {
- FilePath = filePath;
- VersionStamp = versionStamp;
- Import = import;
- }
-
- public string FilePath { get; }
-
- public VersionStamp VersionStamp { get; }
-
- public DocumentSnapshot Import { get; }
-
- public bool Equals(ImportItem other)
- {
- return
- FilePathComparer.Instance.Equals(FilePath, other.FilePath) &&
- VersionStamp == other.VersionStamp;
- }
-
- public override bool Equals(object obj)
- {
- return obj is ImportItem item ? Equals(item) : false;
- }
-
- public override int GetHashCode()
- {
- var hash = new HashCodeCombiner();
- hash.Add(FilePath, FilePathComparer.Instance);
- hash.Add(VersionStamp);
- return hash;
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs
deleted file mode 100644
index 96b927e42f46..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class DocumentImportsTracker
- {
- private readonly object _lock;
-
- private IReadOnlyList _imports;
-
- public DocumentImportsTracker()
- {
- _lock = new object();
- }
-
- public IReadOnlyList GetImports(ProjectSnapshot project, DocumentSnapshot document)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- if (_imports == null)
- {
- lock (_lock)
- {
- if (_imports == null)
- {
- _imports = GetImportsCore(project, document);
- }
- }
- }
-
- return _imports;
- }
-
- private IReadOnlyList GetImportsCore(ProjectSnapshot project, DocumentSnapshot document)
- {
- var projectEngine = project.GetProjectEngine();
- var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault();
- var projectItem = projectEngine.FileSystem.GetItem(document.FilePath);
- var importItems = importFeature?.GetImports(projectItem).Where(i => i.Exists);
- if (importItems == null)
- {
- return Array.Empty();
- }
-
- var imports = new List();
- foreach (var item in importItems)
- {
- if (item.PhysicalPath == null)
- {
- // This is a default import.
- var defaultImport = new DefaultImportDocumentSnapshot(project, item);
- imports.Add(defaultImport);
- }
- else
- {
- var import = project.GetDocument(item.PhysicalPath);
- if (import == null)
- {
- // We are not tracking this document in this project. So do nothing.
- continue;
- }
-
- imports.Add(import);
- }
- }
-
- return imports;
- }
-
- private class DefaultImportDocumentSnapshot : DocumentSnapshot
- {
- private ProjectSnapshot _project;
- private RazorProjectItem _importItem;
- private SourceText _sourceText;
- private VersionStamp _version;
- private DocumentGeneratedOutputTracker _generatedOutput;
-
- public DefaultImportDocumentSnapshot(ProjectSnapshot project, RazorProjectItem item)
- {
- _project = project;
- _importItem = item;
- _version = VersionStamp.Default;
- _generatedOutput = new DocumentGeneratedOutputTracker(null);
- }
-
- public override string FilePath => null;
-
- public override string TargetPath => null;
-
- public override Task GetGeneratedOutputAsync()
- {
- return _generatedOutput.GetGeneratedOutputInitializationTask(_project, this);
- }
-
- public override IReadOnlyList GetImports()
- {
- return Array.Empty();
- }
-
- public async override Task GetTextAsync()
- {
- using (var stream = _importItem.Read())
- using (var reader = new StreamReader(stream))
- {
- var content = await reader.ReadToEndAsync();
- _sourceText = SourceText.From(content);
- }
-
- return _sourceText;
- }
-
- public override Task GetTextVersionAsync()
- {
- return Task.FromResult(_version);
- }
-
- public override bool TryGetText(out SourceText result)
- {
- if (_sourceText != null)
- {
- result = _sourceText;
- return true;
- }
-
- result = null;
- return false;
- }
-
- public override bool TryGetTextVersion(out VersionStamp result)
- {
- result = _version;
- return true;
- }
-
- public override bool TryGetGeneratedOutput(out RazorCodeDocument result)
- {
- if (_generatedOutput.IsResultAvailable)
- {
- result = GetGeneratedOutputAsync().Result;
- return true;
- }
-
- result = null;
- return false;
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs
deleted file mode 100644
index 0cc9da8f04e1..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal abstract class DocumentSnapshot
- {
- public abstract string FilePath { get; }
-
- public abstract string TargetPath { get; }
-
- public abstract IReadOnlyList GetImports();
-
- public abstract Task GetTextAsync();
-
- public abstract Task GetTextVersionAsync();
-
- public abstract Task GetGeneratedOutputAsync();
-
- public abstract bool TryGetText(out SourceText result);
-
- public abstract bool TryGetTextVersion(out VersionStamp result);
-
- public abstract bool TryGetGeneratedOutput(out RazorCodeDocument result);
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs
deleted file mode 100644
index d1fb05b67a86..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class DocumentState
- {
- private static readonly TextAndVersion EmptyText = TextAndVersion.Create(
- SourceText.From(string.Empty),
- VersionStamp.Default);
-
- public static readonly Func> EmptyLoader = () => Task.FromResult(EmptyText);
-
- private readonly object _lock;
-
- private Func> _loader;
- private Task _loaderTask;
- private SourceText _sourceText;
- private VersionStamp? _version;
-
- private DocumentGeneratedOutputTracker _generatedOutput;
- private DocumentImportsTracker _imports;
-
- public static DocumentState Create(
- HostWorkspaceServices services,
- HostDocument hostDocument,
- Func> loader)
- {
- if (services == null)
- {
- throw new ArgumentNullException(nameof(services));
- }
-
- if (hostDocument == null)
- {
- throw new ArgumentNullException(nameof(hostDocument));
- }
-
- loader = loader ?? EmptyLoader;
- return new DocumentState(services, hostDocument, null, null, loader);
- }
-
- // Internal for testing
- internal DocumentState(
- HostWorkspaceServices services,
- HostDocument hostDocument,
- SourceText text,
- VersionStamp? version,
- Func> loader)
- {
- Services = services;
- HostDocument = hostDocument;
- _sourceText = text;
- _version = version;
- _loader = loader;
- _lock = new object();
- }
-
- public HostDocument HostDocument { get; }
-
- public HostWorkspaceServices Services { get; }
-
- public DocumentGeneratedOutputTracker GeneratedOutput
- {
- get
- {
- if (_generatedOutput == null)
- {
- lock (_lock)
- {
- if (_generatedOutput == null)
- {
- _generatedOutput = new DocumentGeneratedOutputTracker(null);
- }
- }
- }
-
- return _generatedOutput;
- }
- }
-
- public DocumentImportsTracker Imports
- {
- get
- {
- if (_imports == null)
- {
- lock (_lock)
- {
- if (_imports == null)
- {
- _imports = new DocumentImportsTracker();
- }
- }
- }
-
- return _imports;
- }
- }
-
- public async Task GetTextAsync()
- {
- if (TryGetText(out var text))
- {
- return text;
- }
-
- lock (_lock)
- {
- _loaderTask = _loader();
- }
-
- return (await _loaderTask.ConfigureAwait(false)).Text;
- }
-
- public async Task GetTextVersionAsync()
- {
- if (TryGetTextVersion(out var version))
- {
- return version;
- }
-
- lock (_lock)
- {
- _loaderTask = _loader();
- }
-
- return (await _loaderTask.ConfigureAwait(false)).Version;
- }
-
- public bool TryGetText(out SourceText result)
- {
- if (_sourceText != null)
- {
- result = _sourceText;
- return true;
- }
-
- if (_loaderTask != null && _loaderTask.IsCompleted)
- {
- result = _loaderTask.Result.Text;
- return true;
- }
-
- result = null;
- return false;
- }
-
- public bool TryGetTextVersion(out VersionStamp result)
- {
- if (_version != null)
- {
- result = _version.Value;
- return true;
- }
-
- if (_loaderTask != null && _loaderTask.IsCompleted)
- {
- result = _loaderTask.Result.Version;
- return true;
- }
-
- result = default;
- return false;
- }
-
- public virtual DocumentState WithConfigurationChange()
- {
- var state = new DocumentState(Services, HostDocument, _sourceText, _version, _loader);
-
- // The source could not have possibly changed.
- state._sourceText = _sourceText;
- state._version = _version;
- state._loaderTask = _loaderTask;
-
- return state;
- }
-
- public virtual DocumentState WithWorkspaceProjectChange()
- {
- var state = new DocumentState(Services, HostDocument, _sourceText, _version, _loader);
-
- // The source could not have possibly changed.
- state._sourceText = _sourceText;
- state._version = _version;
- state._loaderTask = _loaderTask;
-
- // Opportunistically cache the generated code
- state._generatedOutput = _generatedOutput?.Fork();
-
- return state;
- }
-
- public virtual DocumentState WithText(SourceText sourceText, VersionStamp version)
- {
- if (sourceText == null)
- {
- throw new ArgumentNullException(nameof(sourceText));
- }
-
- return new DocumentState(Services, HostDocument, sourceText, version, null);
- }
-
- public virtual DocumentState WithTextLoader(Func> loader)
- {
- if (loader == null)
- {
- throw new ArgumentNullException(nameof(loader));
- }
-
- return new DocumentState(Services, HostDocument, null, null, loader);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs
deleted file mode 100644
index cd87c074deda..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class EphemeralProjectSnapshot : ProjectSnapshot
- {
- private static readonly Task> EmptyTagHelpers = Task.FromResult>(Array.Empty());
-
- private readonly HostWorkspaceServices _services;
- private readonly Lazy _projectEngine;
-
- public EphemeralProjectSnapshot(HostWorkspaceServices services, string filePath)
- {
- if (services == null)
- {
- throw new ArgumentNullException(nameof(services));
- }
-
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- _services = services;
- FilePath = filePath;
-
- _projectEngine = new Lazy(CreateProjectEngine);
- }
-
- public override RazorConfiguration Configuration => FallbackRazorConfiguration.MVC_2_1;
-
- public override IEnumerable DocumentFilePaths => Array.Empty();
-
- public override string FilePath { get; }
-
- public override bool IsInitialized => false;
-
- public override VersionStamp Version { get; } = VersionStamp.Default;
-
- public override Project WorkspaceProject => null;
-
- public override DocumentSnapshot GetDocument(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return null;
- }
-
- public override RazorProjectEngine GetProjectEngine()
- {
- return _projectEngine.Value;
- }
-
- public override Task> GetTagHelpersAsync()
- {
- return EmptyTagHelpers;
- }
-
- public override bool TryGetTagHelpers(out IReadOnlyList result)
- {
- result = EmptyTagHelpers.Result;
- return true;
- }
-
- private RazorProjectEngine CreateProjectEngine()
- {
- var factory = _services.GetRequiredService();
- return factory.Create(this);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs
deleted file mode 100644
index 024b421312a2..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class FallbackRazorConfiguration : RazorConfiguration
- {
- public static readonly RazorConfiguration MVC_1_0 = new FallbackRazorConfiguration(
- RazorLanguageVersion.Version_1_0,
- "MVC-1.0",
- new[] { new FallbackRazorExtension("MVC-1.0"), });
-
- public static readonly RazorConfiguration MVC_1_1 = new FallbackRazorConfiguration(
- RazorLanguageVersion.Version_1_1,
- "MVC-1.1",
- new[] { new FallbackRazorExtension("MVC-1.1"), });
-
- public static readonly RazorConfiguration MVC_2_0 = new FallbackRazorConfiguration(
- RazorLanguageVersion.Version_2_0,
- "MVC-2.0",
- new[] { new FallbackRazorExtension("MVC-2.0"), });
-
- public static readonly RazorConfiguration MVC_2_1 = new FallbackRazorConfiguration(
- RazorLanguageVersion.Version_2_1,
- "MVC-2.1",
- new[] { new FallbackRazorExtension("MVC-2.1"), });
-
-
- public static RazorConfiguration SelectConfiguration(Version version)
- {
- if (version.Major == 1 && version.Minor == 0)
- {
- return MVC_1_0;
- }
- else if (version.Major == 1 && version.Minor == 1)
- {
- return MVC_1_1;
- }
- else if (version.Major == 2 && version.Minor == 0)
- {
- return MVC_2_0;
- }
- else if (version.Major == 2 && version.Minor == 1)
- {
- return MVC_2_1;
- }
- else
- {
- return MVC_2_1;
- }
- }
-
- public FallbackRazorConfiguration(
- RazorLanguageVersion languageVersion,
- string configurationName,
- RazorExtension[] extensions)
- {
- if (languageVersion == null)
- {
- throw new ArgumentNullException(nameof(languageVersion));
- }
-
- if (configurationName == null)
- {
- throw new ArgumentNullException(nameof(configurationName));
- }
-
- if (extensions == null)
- {
- throw new ArgumentNullException(nameof(extensions));
- }
-
- LanguageVersion = languageVersion;
- ConfigurationName = configurationName;
- Extensions = extensions;
- }
-
- public override string ConfigurationName { get; }
-
- public override IReadOnlyList Extensions { get; }
-
- public override RazorLanguageVersion LanguageVersion { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs
deleted file mode 100644
index 5080b0705dca..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class FallbackRazorExtension : RazorExtension
- {
- public FallbackRazorExtension(string extensionName)
- {
- if (extensionName == null)
- {
- throw new ArgumentNullException(nameof(extensionName));
- }
-
- ExtensionName = extensionName;
- }
-
- public override string ExtensionName { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs
deleted file mode 100644
index 859cc0df3246..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class HostDocument
- {
- public HostDocument(string filePath, string targetPath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- if (targetPath == null)
- {
- throw new ArgumentNullException(nameof(targetPath));
- }
-
- FilePath = filePath;
- TargetPath = targetPath;
- }
-
- public string FilePath { get; }
-
- public string TargetPath { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs
deleted file mode 100644
index cf3c1524b6ed..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class HostProject
- {
- public HostProject(string projectFilePath, RazorConfiguration razorConfiguration)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (razorConfiguration == null)
- {
- throw new ArgumentNullException(nameof(razorConfiguration));
- }
-
- FilePath = projectFilePath;
- Configuration = razorConfiguration;
- }
-
- public RazorConfiguration Configuration { get; }
-
- public string FilePath { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs
deleted file mode 100644
index f03a31b0ae4e..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor.Workspaces.ProjectSystem
-{
- // This is a marker class to allow us to know when potential breaking changes might impact live share.
- // This is intentionally not abstract so any API changes that happen to ProjectSnapshot will break this.
- internal class LiveShareProjectSnapshotBase : ProjectSnapshot
- {
- public override RazorConfiguration Configuration => throw new NotImplementedException();
-
- public override IEnumerable DocumentFilePaths => throw new NotImplementedException();
-
- public override string FilePath => throw new NotImplementedException();
-
- public override bool IsInitialized => throw new NotImplementedException();
-
- public override VersionStamp Version => throw new NotImplementedException();
-
- public override Project WorkspaceProject => throw new NotImplementedException();
-
- public override DocumentSnapshot GetDocument(string filePath) => throw new NotImplementedException();
-
- public override RazorProjectEngine GetProjectEngine() => throw new NotImplementedException();
-
- public override Task> GetTagHelpersAsync() => throw new NotImplementedException();
-
- public override bool TryGetTagHelpers(out IReadOnlyList result) => throw new NotImplementedException();
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs
deleted file mode 100644
index a163ba5f1b16..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class ProjectChangeEventArgs : EventArgs
- {
- public ProjectChangeEventArgs(string projectFilePath, ProjectChangeKind kind)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- ProjectFilePath = projectFilePath;
- Kind = kind;
- }
-
- public ProjectChangeEventArgs(string projectFilePath, string documentFilePath, ProjectChangeKind kind)
- {
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- ProjectFilePath = projectFilePath;
- DocumentFilePath = documentFilePath;
- Kind = kind;
- }
-
- public string ProjectFilePath { get; }
-
- public string DocumentFilePath { get; }
-
- public ProjectChangeKind Kind { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs
deleted file mode 100644
index 98bd0a40101d..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal enum ProjectChangeKind
- {
- ProjectAdded,
- ProjectRemoved,
- ProjectChanged,
- DocumentAdded,
- DocumentRemoved,
-
- // This could be a state change (opened/closed) or a content change.
- DocumentChanged,
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectDifference.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectDifference.cs
deleted file mode 100644
index 138acdb312d8..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectDifference.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- [Flags]
- internal enum ProjectDifference
- {
- None = 0,
- ConfigurationChanged = 1,
- WorkspaceProjectAdded = 2,
- WorkspaceProjectRemoved = 4,
- WorkspaceProjectChanged = 8,
- DocumentAdded = 16,
- DocumentRemoved = 32,
- DocumentChanged = 64,
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs
deleted file mode 100644
index 6e54daed0bd8..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class ProjectEngineTracker
- {
- private const ProjectDifference Mask = ProjectDifference.ConfigurationChanged;
-
- private readonly object _lock = new object();
-
- private readonly HostWorkspaceServices _services;
- private RazorProjectEngine _projectEngine;
-
- public ProjectEngineTracker(ProjectState state)
- {
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- _services = state.Services;
- }
-
- public ProjectEngineTracker ForkFor(ProjectState state, ProjectDifference difference)
- {
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- if ((difference & Mask) != 0)
- {
- return null;
- }
-
- return this;
- }
-
- public RazorProjectEngine GetProjectEngine(ProjectSnapshot snapshot)
- {
- if (snapshot == null)
- {
- throw new ArgumentNullException(nameof(snapshot));
- }
-
- if (_projectEngine == null)
- {
- lock (_lock)
- {
- if (_projectEngine == null)
- {
- var factory = _services.GetRequiredService();
- _projectEngine = factory.Create(snapshot);
- }
- }
- }
-
- return _projectEngine;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs
deleted file mode 100644
index 418d117ff271..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal abstract class ProjectSnapshot
- {
- public abstract RazorConfiguration Configuration { get; }
-
- public abstract IEnumerable DocumentFilePaths { get; }
-
- public abstract string FilePath { get; }
-
- public abstract bool IsInitialized { get; }
-
- public abstract VersionStamp Version { get; }
-
- public abstract Project WorkspaceProject { get; }
-
- public abstract RazorProjectEngine GetProjectEngine();
-
- public abstract DocumentSnapshot GetDocument(string filePath);
-
- public abstract Task> GetTagHelpersAsync();
-
- public abstract bool TryGetTagHelpers(out IReadOnlyList result);
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs
deleted file mode 100644
index da27aefe0ce2..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal abstract class ProjectSnapshotChangeTrigger
- {
- public abstract void Initialize(ProjectSnapshotManagerBase projectManager);
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs
deleted file mode 100644
index 40dfec08a920..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal abstract class ProjectSnapshotManager : ILanguageService
- {
- public abstract event EventHandler Changed;
-
- public abstract IReadOnlyList Projects { get; }
-
- public abstract bool IsDocumentOpen(string documentFilePath);
-
- public abstract ProjectSnapshot GetLoadedProject(string filePath);
-
- public abstract ProjectSnapshot GetOrCreateProject(string filePath);
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs
deleted file mode 100644
index 5545bbb3a8d4..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal abstract class ProjectSnapshotManagerBase : ProjectSnapshotManager
- {
- public abstract Workspace Workspace { get; }
-
- public abstract void DocumentAdded(HostProject hostProject, HostDocument hostDocument, TextLoader textLoader);
-
- // Yeah this is kinda ugly.
- public abstract void DocumentOpened(string projectFilePath, string documentFilePath, SourceText sourceText);
-
- public abstract void DocumentClosed(string projectFilePath, string documentFilePath, TextLoader textLoader);
-
- public abstract void DocumentChanged(string projectFilePath, string documentFilePath, TextLoader textLoader);
-
- public abstract void DocumentChanged(string projectFilePath, string documentFilePath, SourceText sourceText);
-
- public abstract void DocumentRemoved(HostProject hostProject, HostDocument hostDocument);
-
- public abstract void HostProjectAdded(HostProject hostProject);
-
- public abstract void HostProjectChanged(HostProject hostProject);
-
- public abstract void HostProjectRemoved(HostProject hostProject);
-
- public abstract void WorkspaceProjectAdded(Project workspaceProject);
-
- public abstract void WorkspaceProjectChanged(Project workspaceProject);
-
- public abstract void WorkspaceProjectRemoved(Project workspaceProject);
-
- public abstract void ReportError(Exception exception);
-
- public abstract void ReportError(Exception exception, ProjectSnapshot project);
-
- public abstract void ReportError(Exception exception, HostProject hostProject);
-
- public abstract void ReportError(Exception exception, Project workspaceProject);
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs
deleted file mode 100644
index 6670ba55a217..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Text;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- // Internal tracker for DefaultProjectSnapshot
- internal class ProjectState
- {
- private static readonly IReadOnlyDictionary EmptyDocuments = new Dictionary();
-
- private readonly object _lock;
-
- private ProjectEngineTracker _projectEngine;
- private ProjectTagHelperTracker _tagHelpers;
-
- public static ProjectState Create(HostWorkspaceServices services, HostProject hostProject, Project workspaceProject = null)
- {
- if (services == null)
- {
- throw new ArgumentNullException(nameof(services));
- }
-
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- return new ProjectState(services, hostProject, workspaceProject);
- }
-
- private ProjectState(
- HostWorkspaceServices services,
- HostProject hostProject,
- Project workspaceProject)
- {
- Services = services;
- HostProject = hostProject;
- WorkspaceProject = workspaceProject;
- Documents = EmptyDocuments;
- Version = VersionStamp.Create();
-
- _lock = new object();
- }
-
- private ProjectState(
- ProjectState older,
- ProjectDifference difference,
- HostProject hostProject,
- Project workspaceProject,
- IReadOnlyDictionary documents)
- {
- if (older == null)
- {
- throw new ArgumentNullException(nameof(older));
- }
-
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- if (documents == null)
- {
- throw new ArgumentNullException(nameof(documents));
- }
-
- Services = older.Services;
- Version = older.Version.GetNewerVersion();
-
- HostProject = hostProject;
- WorkspaceProject = workspaceProject;
- Documents = documents;
-
- _lock = new object();
-
- _projectEngine = older._projectEngine?.ForkFor(this, difference);
- _tagHelpers = older._tagHelpers?.ForkFor(this, difference);
- }
-
- // Internal set for testing.
- public IReadOnlyDictionary Documents { get; internal set; }
-
- public HostProject HostProject { get; }
-
- public HostWorkspaceServices Services { get; }
-
- public Project WorkspaceProject { get; }
-
- public VersionStamp Version { get; }
-
- // Computed State
- public ProjectEngineTracker ProjectEngine
- {
- get
- {
- if (_projectEngine == null)
- {
- lock (_lock)
- {
- if (_projectEngine == null)
- {
- _projectEngine = new ProjectEngineTracker(this);
- }
- }
- }
-
- return _projectEngine;
- }
- }
-
- // Computed State
- public ProjectTagHelperTracker TagHelpers
- {
- get
- {
- if (_tagHelpers == null)
- {
- lock (_lock)
- {
- if (_tagHelpers == null)
- {
- _tagHelpers = new ProjectTagHelperTracker(this);
- }
- }
- }
-
- return _tagHelpers;
- }
- }
-
- public ProjectState WithAddedHostDocument(HostDocument hostDocument, Func> loader)
- {
- if (hostDocument == null)
- {
- throw new ArgumentNullException(nameof(hostDocument));
- }
-
- if (loader == null)
- {
- throw new ArgumentNullException(nameof(loader));
- }
-
- // Ignore attempts to 'add' a document with different data, we only
- // care about one, so it might as well be the one we have.
- if (Documents.ContainsKey(hostDocument.FilePath))
- {
- return this;
- }
-
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value);
- }
-
- documents.Add(hostDocument.FilePath, DocumentState.Create(Services, hostDocument, loader));
-
- var difference = ProjectDifference.DocumentAdded;
- var state = new ProjectState(this, difference, HostProject, WorkspaceProject, documents);
- return state;
- }
-
- public ProjectState WithRemovedHostDocument(HostDocument hostDocument)
- {
- if (hostDocument == null)
- {
- throw new ArgumentNullException(nameof(hostDocument));
- }
-
- if (!Documents.ContainsKey(hostDocument.FilePath))
- {
- return this;
- }
-
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value);
- }
-
- documents.Remove(hostDocument.FilePath);
-
- var difference = ProjectDifference.DocumentRemoved;
- var state = new ProjectState(this, difference, HostProject, WorkspaceProject, documents);
- return state;
- }
-
- public ProjectState WithChangedHostDocument(HostDocument hostDocument, SourceText sourceText, VersionStamp version)
- {
- if (hostDocument == null)
- {
- throw new ArgumentNullException(nameof(hostDocument));
- }
-
- if (!Documents.ContainsKey(hostDocument.FilePath))
- {
- return this;
- }
-
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value);
- }
-
- if (documents.TryGetValue(hostDocument.FilePath, out var document))
- {
- documents[hostDocument.FilePath] = document.WithText(sourceText, version);
- }
-
- var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents);
- return state;
- }
-
- public ProjectState WithChangedHostDocument(HostDocument hostDocument, Func> loader)
- {
- if (hostDocument == null)
- {
- throw new ArgumentNullException(nameof(hostDocument));
- }
-
- if (!Documents.ContainsKey(hostDocument.FilePath))
- {
- return this;
- }
-
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value);
- }
-
- if (documents.TryGetValue(hostDocument.FilePath, out var document))
- {
- documents[hostDocument.FilePath] = document.WithTextLoader(loader);
- }
-
- var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents);
- return state;
- }
-
- public ProjectState WithHostProject(HostProject hostProject)
- {
- if (hostProject == null)
- {
- throw new ArgumentNullException(nameof(hostProject));
- }
-
- if (HostProject.Configuration.Equals(hostProject.Configuration))
- {
- return this;
- }
-
- var difference = ProjectDifference.ConfigurationChanged;
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value.WithConfigurationChange());
- }
-
- var state = new ProjectState(this, difference, hostProject, WorkspaceProject, documents);
- return state;
- }
-
- public ProjectState WithWorkspaceProject(Project workspaceProject)
- {
- var difference = ProjectDifference.None;
- if (WorkspaceProject == null && workspaceProject != null)
- {
- difference |= ProjectDifference.WorkspaceProjectAdded;
- }
- else if (WorkspaceProject != null && workspaceProject == null)
- {
- difference |= ProjectDifference.WorkspaceProjectRemoved;
- }
- else
- {
- // We always update the snapshot right now when the project changes. This is how
- // we deal with changes to the content of C# sources.
- difference |= ProjectDifference.WorkspaceProjectChanged;
- }
-
- if (difference == ProjectDifference.None)
- {
- return this;
- }
-
- var documents = new Dictionary(FilePathComparer.Instance);
- foreach (var kvp in Documents)
- {
- documents.Add(kvp.Key, kvp.Value.WithWorkspaceProjectChange());
- }
-
- var state = new ProjectState(this, difference, HostProject, workspaceProject, documents);
- return state;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs
deleted file mode 100644
index 43dfebe86445..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class ProjectSystemRazorConfiguration : RazorConfiguration
- {
- public ProjectSystemRazorConfiguration(
- RazorLanguageVersion languageVersion,
- string configurationName,
- RazorExtension[] extensions)
- {
- if (languageVersion == null)
- {
- throw new ArgumentNullException(nameof(languageVersion));
- }
-
- if (configurationName == null)
- {
- throw new ArgumentNullException(nameof(configurationName));
- }
-
- if (extensions == null)
- {
- throw new ArgumentNullException(nameof(extensions));
- }
-
- LanguageVersion = languageVersion;
- ConfigurationName = configurationName;
- Extensions = extensions;
- }
-
- public override string ConfigurationName { get; }
-
- public override IReadOnlyList Extensions { get; }
-
- public override RazorLanguageVersion LanguageVersion { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs
deleted file mode 100644
index 77f742c5639a..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class ProjectSystemRazorExtension : RazorExtension
- {
- public ProjectSystemRazorExtension(string extensionName)
- {
- if (extensionName == null)
- {
- throw new ArgumentNullException(nameof(extensionName));
- }
-
- ExtensionName = extensionName;
- }
-
- public override string ExtensionName { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs
deleted file mode 100644
index 0c3be4ddec9e..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- internal class ProjectTagHelperTracker
- {
- private const ProjectDifference Mask =
- ProjectDifference.ConfigurationChanged |
- ProjectDifference.WorkspaceProjectAdded |
- ProjectDifference.WorkspaceProjectChanged |
- ProjectDifference.WorkspaceProjectRemoved;
-
- private readonly object _lock = new object();
- private readonly HostWorkspaceServices _services;
-
- private Task> _task;
-
- public ProjectTagHelperTracker(ProjectState state)
- {
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- _services = state.Services;
- }
-
- public bool IsResultAvailable => _task?.IsCompleted == true;
-
- public ProjectTagHelperTracker ForkFor(ProjectState state, ProjectDifference difference)
- {
- if (state == null)
- {
- throw new ArgumentNullException(nameof(state));
- }
-
- if ((difference & Mask) != 0)
- {
- return null;
- }
-
- return this;
- }
-
- public Task> GetTagHelperInitializationTask(ProjectSnapshot snapshot)
- {
- if (snapshot == null)
- {
- throw new ArgumentNullException(nameof(snapshot));
- }
-
- if (_task == null)
- {
- lock (_lock)
- {
- if (_task == null)
- {
- _task = GetTagHelperInitializationTaskCore(snapshot);
- }
- }
- }
-
- return _task;
- }
-
- private async Task> GetTagHelperInitializationTaskCore(ProjectSnapshot snapshot)
- {
- var resolver = _services.GetLanguageServices(RazorLanguage.Name).GetRequiredService();
- return (await resolver.GetTagHelpersAsync(snapshot)).Descriptors;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs
deleted file mode 100644
index f5bbee95de5d..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Composition;
-using System.Diagnostics;
-using System.Threading.Tasks;
-
-namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
-{
- [Export(typeof(ProjectSnapshotChangeTrigger))]
- internal class WorkspaceProjectSnapshotChangeTrigger : ProjectSnapshotChangeTrigger
- {
- private ProjectSnapshotManagerBase _projectManager;
-
- public int ProjectChangeDelay { get; set; } = 3 * 1000;
-
- // We throttle updates to projects to prevent doing too much work while the projects
- // are being initialized.
- //
- // Internal for testing
- internal Dictionary _deferredUpdates;
-
- public override void Initialize(ProjectSnapshotManagerBase projectManager)
- {
- _projectManager = projectManager;
- _projectManager.Workspace.WorkspaceChanged += Workspace_WorkspaceChanged;
-
- _deferredUpdates = new Dictionary();
-
- InitializeSolution(_projectManager.Workspace.CurrentSolution);
- }
-
- private void InitializeSolution(Solution solution)
- {
- Debug.Assert(solution != null);
-
- foreach (var project in solution.Projects)
- {
- _projectManager.WorkspaceProjectAdded(project);
- }
- }
-
- // Internal for testing
- internal void Workspace_WorkspaceChanged(object sender, WorkspaceChangeEventArgs e)
- {
- Project project;
- switch (e.Kind)
- {
- case WorkspaceChangeKind.ProjectAdded:
- {
- project = e.NewSolution.GetProject(e.ProjectId);
- Debug.Assert(project != null);
-
- _projectManager.WorkspaceProjectAdded(project);
- break;
- }
-
- case WorkspaceChangeKind.ProjectChanged:
- case WorkspaceChangeKind.ProjectReloaded:
- {
- EnqueueUpdate(e.ProjectId);
- break;
- }
-
- case WorkspaceChangeKind.ProjectRemoved:
- {
- project = e.OldSolution.GetProject(e.ProjectId);
- Debug.Assert(project != null);
-
- _projectManager.WorkspaceProjectRemoved(project);
- break;
- }
-
- case WorkspaceChangeKind.SolutionAdded:
- case WorkspaceChangeKind.SolutionChanged:
- case WorkspaceChangeKind.SolutionCleared:
- case WorkspaceChangeKind.SolutionReloaded:
- case WorkspaceChangeKind.SolutionRemoved:
-
- if (e.OldSolution != null)
- {
- foreach (var p in e.OldSolution.Projects)
- {
- _projectManager.WorkspaceProjectRemoved(p);
- }
- }
-
- InitializeSolution(e.NewSolution);
- break;
- }
- }
-
- private void EnqueueUpdate(ProjectId projectId)
- {
- // A race is not possible here because we use the main thread to synchronize the updates
- // by capturing the sync context.
- if (!_deferredUpdates.TryGetValue(projectId, out var update) || update.IsCompleted)
- {
- _deferredUpdates[projectId] = UpdateAfterDelay(projectId);
- }
- }
-
- private async Task UpdateAfterDelay(ProjectId projectId)
- {
- await Task.Delay(ProjectChangeDelay);
-
- var solution = _projectManager.Workspace.CurrentSolution;
- var workspaceProject = solution.GetProject(projectId);
- if (workspaceProject != null)
- {
- _projectManager.WorkspaceProjectChanged(workspaceProject);
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs
deleted file mode 100644
index fefb5cd1de5a..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Runtime.CompilerServices;
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.RazorAddin, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs
deleted file mode 100644
index 058b78c6ed93..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-namespace Microsoft.CodeAnalysis.Razor.Workspaces
-{
- using System.Globalization;
- using System.Reflection;
- using System.Resources;
-
- internal static class Resources
- {
- private static readonly ResourceManager _resourceManager
- = new ResourceManager("Microsoft.CodeAnalysis.Razor.Workspaces.Resources", typeof(Resources).GetTypeInfo().Assembly);
-
- ///
- /// Value cannot be null or an empty string.
- ///
- internal static string ArgumentCannotBeNullOrEmpty
- {
- get => GetString("ArgumentCannotBeNullOrEmpty");
- }
-
- ///
- /// Value cannot be null or an empty string.
- ///
- internal static string FormatArgumentCannotBeNullOrEmpty()
- => GetString("ArgumentCannotBeNullOrEmpty");
-
- ///
- /// {0} must be called on a background thread.
- ///
- internal static string ForegroundDispatcher_AssertBackgroundThread
- {
- get => GetString("ForegroundDispatcher_AssertBackgroundThread");
- }
-
- ///
- /// {0} must be called on a background thread.
- ///
- internal static string FormatForegroundDispatcher_AssertBackgroundThread(object p0)
- => string.Format(CultureInfo.CurrentCulture, GetString("ForegroundDispatcher_AssertBackgroundThread"), p0);
-
- ///
- /// {0} must be called on the foreground thread.
- ///
- internal static string ForegroundDispatcher_AssertForegroundThread
- {
- get => GetString("ForegroundDispatcher_AssertForegroundThread");
- }
-
- ///
- /// {0} must be called on the foreground thread.
- ///
- internal static string FormatForegroundDispatcher_AssertForegroundThread(object p0)
- => string.Format(CultureInfo.CurrentCulture, GetString("ForegroundDispatcher_AssertForegroundThread"), p0);
-
- ///
- /// The method
- ///
- internal static string ForegroundDispatcher_NoMethodNamePlaceholder
- {
- get => GetString("ForegroundDispatcher_NoMethodNamePlaceholder");
- }
-
- ///
- /// The method
- ///
- internal static string FormatForegroundDispatcher_NoMethodNamePlaceholder()
- => GetString("ForegroundDispatcher_NoMethodNamePlaceholder");
-
- private static string GetString(string name, params string[] formatterNames)
- {
- var value = _resourceManager.GetString(name);
-
- System.Diagnostics.Debug.Assert(value != null);
-
- if (formatterNames != null)
- {
- for (var i = 0; i < formatterNames.Length; i++)
- {
- value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
- }
- }
-
- return value;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx
deleted file mode 100644
index fca5a30e158d..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Value cannot be null or an empty string.
-
-
- {0} must be called on a background thread.
-
-
- {0} must be called on the foreground thread.
-
-
- The method
-
-
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SourceTextExtensions.cs
deleted file mode 100644
index efc74344d5ee..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SourceTextExtensions.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Text
-{
- internal static class SourceTextExtensions
- {
- public static RazorSourceDocument GetRazorSourceDocument(this SourceText sourceText, string fileName)
- {
- if (sourceText == null)
- {
- throw new ArgumentNullException(nameof(sourceText));
- }
-
- var content = sourceText.ToString();
-
- return RazorSourceDocument.Create(content, fileName);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs
deleted file mode 100644
index 0e8c7b19efc7..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- public sealed class TagHelperResolutionResult
- {
- internal static TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty(), Array.Empty());
-
- public TagHelperResolutionResult(IReadOnlyList descriptors, IReadOnlyList diagnostics)
- {
- Descriptors = descriptors;
- Diagnostics = diagnostics;
- }
-
- public IReadOnlyList Descriptors { get; }
-
- public IReadOnlyList Diagnostics { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs
deleted file mode 100644
index 4316f6ee3be9..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal abstract class TagHelperResolver : ILanguageService
- {
- public abstract Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default);
-
- protected virtual async Task GetTagHelpersAsync(ProjectSnapshot project, RazorProjectEngine engine)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (engine == null)
- {
- throw new ArgumentNullException(nameof(engine));
- }
-
- if (project.WorkspaceProject == null)
- {
- return TagHelperResolutionResult.Empty;
- }
-
- var providers = engine.Engine.Features.OfType().ToArray();
- if (providers.Length == 0)
- {
- return TagHelperResolutionResult.Empty;
- }
-
- var results = new List();
- var context = TagHelperDescriptorProviderContext.Create(results);
- context.ExcludeHidden = true;
- context.IncludeDocumentation = true;
-
- var compilation = await project.WorkspaceProject.GetCompilationAsync().ConfigureAwait(false);
- if (CompilationTagHelperFeature.IsValidCompilation(compilation))
- {
- context.SetCompilation(compilation);
- }
-
- for (var i = 0; i < providers.Length; i++)
- {
- var provider = providers[i];
- provider.Execute(context);
- }
-
- return new TagHelperResolutionResult(results, Array.Empty());
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs
index 0de18b91dcfb..e585739ec566 100644
--- a/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs
+++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs
@@ -7,10 +7,4 @@
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj
deleted file mode 100644
index 369dd8202089..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure.
- net46
- false
-
-
-
-
- Serialization\%(FileName)%(Extension)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs
deleted file mode 100644
index fd7f2d2f87ce..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
-[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs
deleted file mode 100644
index 16ababe0db7f..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Remote.Razor
-{
- internal class RazorLanguageService : RazorServiceBase
- {
- public RazorLanguageService(Stream stream, IServiceProvider serviceProvider)
- : base(stream, serviceProvider)
- {
- }
-
- public async Task GetTagHelpersAsync(ProjectSnapshotHandle projectHandle, string factoryTypeName, CancellationToken cancellationToken = default)
- {
- var project = await GetProjectSnapshotAsync(projectHandle, cancellationToken).ConfigureAwait(false);
-
- return await RazorServices.TagHelperResolver.GetTagHelpersAsync(project, factoryTypeName, cancellationToken);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs
deleted file mode 100644
index 289d75cc0f60..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Remote.Razor
-{
- internal abstract class RazorServiceBase : ServiceHubServiceBase
- {
- public RazorServiceBase(Stream stream, IServiceProvider serviceProvider)
- : base(serviceProvider, stream)
- {
- RazorServices = new RazorServices();
-
- Rpc.JsonSerializer.Converters.RegisterRazorConverters();
-
- // Due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950
- // We need to manually start the RPC connection. Otherwise we'd be opting ourselves into
- // race condition prone call paths.
- Rpc.StartListening();
- }
-
- protected RazorServices RazorServices { get; }
-
- protected virtual async Task GetProjectSnapshotAsync(ProjectSnapshotHandle projectHandle, CancellationToken cancellationToken)
- {
- if (projectHandle == null)
- {
- throw new ArgumentNullException(nameof(projectHandle));
- }
-
- var solution = await GetSolutionAsync(cancellationToken).ConfigureAwait(false);
- var workspaceProject = solution.GetProject(projectHandle.WorkspaceProjectId);
-
- return new SerializedProjectSnapshot(projectHandle.FilePath, projectHandle.Configuration, workspaceProject);
- }
-
- private class SerializedProjectSnapshot : ProjectSnapshot
- {
- public SerializedProjectSnapshot(string filePath, RazorConfiguration configuration, Project workspaceProject)
- {
- FilePath = filePath;
- Configuration = configuration;
- WorkspaceProject = workspaceProject;
-
- IsInitialized = true;
- Version = VersionStamp.Default;
- }
-
- public override RazorConfiguration Configuration { get; }
-
- public override IEnumerable DocumentFilePaths => Array.Empty();
-
- public override string FilePath { get; }
-
- public override bool IsInitialized { get; }
-
- public override VersionStamp Version { get; }
-
- public override Project WorkspaceProject { get; }
-
- public override DocumentSnapshot GetDocument(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return null;
- }
-
- public override RazorProjectEngine GetProjectEngine()
- {
- throw new NotImplementedException();
- }
-
- public override Task> GetTagHelpersAsync()
- {
- throw new NotImplementedException();
- }
-
- public override bool TryGetTagHelpers(out IReadOnlyList result)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs
deleted file mode 100644
index d3a60a400c88..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- // Provides access to Razor language and workspace services that are avialable in the OOP host.
- //
- // Since we don't have access to the workspace we only have access to some specific things
- // that we can construct directly.
- internal class RazorServices
- {
- public RazorServices()
- {
- FallbackProjectEngineFactory = new FallbackProjectEngineFactory();
- TagHelperResolver = new RemoteTagHelperResolver(FallbackProjectEngineFactory);
- }
-
- public IFallbackProjectEngineFactory FallbackProjectEngineFactory { get; }
-
- public RemoteTagHelperResolver TagHelperResolver { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs
deleted file mode 100644
index f4ccaf775505..000000000000
--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.CodeAnalysis.Razor
-{
- internal class RemoteTagHelperResolver : TagHelperResolver
- {
- private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_0;
-
- private readonly IFallbackProjectEngineFactory _fallbackFactory;
-
- public RemoteTagHelperResolver(IFallbackProjectEngineFactory fallbackFactory)
- {
- if (fallbackFactory == null)
- {
- throw new ArgumentNullException(nameof(fallbackFactory));
- }
-
- _fallbackFactory = fallbackFactory;
- }
-
- public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default)
- {
- throw new NotImplementedException();
- }
-
- public Task GetTagHelpersAsync(ProjectSnapshot project, string factoryTypeName, CancellationToken cancellationToken = default)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (project.Configuration == null || project.WorkspaceProject == null)
- {
- return Task.FromResult(TagHelperResolutionResult.Empty);
- }
-
- var engine = CreateProjectEngine(project, factoryTypeName);
- return GetTagHelpersAsync(project, engine);
- }
-
- internal RazorProjectEngine CreateProjectEngine(ProjectSnapshot project, string factoryTypeName)
- {
- // This section is really similar to the code DefaultProjectEngineFactoryService
- // but with a few differences that are significant in the remote scenario
- //
- // Most notably, we are going to find the Tag Helpers using a compilation, and we have
- // no editor settings.
- //
- // The default configuration currently matches MVC-2.0. Beyond MVC-2.0 we added SDK support for
- // properly detecting project versions, so that's a good version to assume when we can't find a
- // configuration.
- var configuration = project?.Configuration ?? DefaultConfiguration;
-
- // If there's no factory to handle the configuration then fall back to a very basic configuration.
- //
- // This will stop a crash from happening in this case (misconfigured project), but will still make
- // it obvious to the user that something is wrong.
- var factory = CreateFactory(configuration, factoryTypeName) ?? _fallbackFactory;
- return factory.Create(configuration, RazorProjectFileSystem.Empty, b => { });
- }
-
- private IProjectEngineFactory CreateFactory(RazorConfiguration configuration, string factoryTypeName)
- {
- if (factoryTypeName == null)
- {
- return null;
- }
-
- return (IProjectEngineFactory)Activator.CreateInstance(Type.GetType(factoryTypeName, throwOnError: true));
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs
deleted file mode 100644
index 1d9ba282e9ba..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Flags]
- public enum AcceptedCharacters
- {
- None = 0,
- NewLine = 1,
- WhiteSpace = 2,
-
- NonWhiteSpace = 4,
-
- AllWhiteSpace = NewLine | WhiteSpace,
- Any = AllWhiteSpace | NonWhiteSpace,
-
- AnyExceptNewline = NonWhiteSpace | WhiteSpace
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs
deleted file mode 100644
index 08b4ffe03253..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public class AttributeCompletionContext
- {
- public AttributeCompletionContext(
- TagHelperDocumentContext documentContext,
- IEnumerable existingCompletions,
- string currentTagName,
- string currentAttributeName,
- IEnumerable> attributes,
- string currentParentTagName,
- bool currentParentIsTagHelper,
- Func inHTMLSchema)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- if (existingCompletions == null)
- {
- throw new ArgumentNullException(nameof(existingCompletions));
- }
-
- if (currentTagName == null)
- {
- throw new ArgumentNullException(nameof(currentTagName));
- }
-
- if (attributes == null)
- {
- throw new ArgumentNullException(nameof(attributes));
- }
-
- if (inHTMLSchema == null)
- {
- throw new ArgumentNullException(nameof(inHTMLSchema));
- }
-
- DocumentContext = documentContext;
- ExistingCompletions = existingCompletions;
- CurrentTagName = currentTagName;
- CurrentAttributeName = currentAttributeName;
- Attributes = attributes;
- CurrentParentTagName = currentParentTagName;
- CurrentParentIsTagHelper = currentParentIsTagHelper;
- InHTMLSchema = inHTMLSchema;
- }
-
- public TagHelperDocumentContext DocumentContext { get; }
-
- public IEnumerable ExistingCompletions { get; }
-
- public string CurrentTagName { get; }
-
- public string CurrentAttributeName { get; }
-
- public IEnumerable> Attributes { get; }
-
- public string CurrentParentTagName { get; }
-
- public bool CurrentParentIsTagHelper { get; }
-
- public Func InHTMLSchema { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs
deleted file mode 100644
index c6a11d67ed98..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public abstract class AttributeCompletionResult
- {
- private AttributeCompletionResult()
- {
- }
-
- public abstract IReadOnlyDictionary> Completions { get; }
-
- internal static AttributeCompletionResult Create(Dictionary> completions)
- {
- var readonlyCompletions = completions.ToDictionary(
- key => key.Key,
- value => (IEnumerable)value.Value,
- completions.Comparer);
- var result = new DefaultAttributeCompletionResult(readonlyCompletions);
-
- return result;
- }
-
- private class DefaultAttributeCompletionResult : AttributeCompletionResult
- {
- private readonly IReadOnlyDictionary> _completions;
-
- public DefaultAttributeCompletionResult(IReadOnlyDictionary> completions)
- {
- _completions = completions;
- }
-
- public override IReadOnlyDictionary> Completions => _completions;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs
deleted file mode 100644
index 90f37f1273f8..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs
+++ /dev/null
@@ -1,403 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class BackgroundParser : IDisposable
- {
- private MainThreadState _main;
- private BackgroundThread _bg;
-
- public BackgroundParser(RazorProjectEngine projectEngine, string filePath, string projectDirectory)
- {
- _main = new MainThreadState(filePath);
- _bg = new BackgroundThread(_main, projectEngine, filePath, projectDirectory);
-
- _main.ResultsReady += (sender, args) => OnResultsReady(args);
- }
-
- ///
- /// Fired on the main thread.
- ///
- public event EventHandler ResultsReady;
-
- public bool IsIdle
- {
- get { return _main.IsIdle; }
- }
-
- public void Start()
- {
- _bg.Start();
- }
-
- public void Cancel()
- {
- _main.Cancel();
- }
-
- public ChangeReference QueueChange(SourceChange change, ITextSnapshot snapshot)
- {
- var changeReference = new ChangeReference(change, snapshot);
- _main.QueueChange(changeReference);
- return changeReference;
- }
-
- public void Dispose()
- {
- _main.Cancel();
- }
-
- public IDisposable SynchronizeMainThreadState()
- {
- return _main.Lock();
- }
-
- protected virtual void OnResultsReady(BackgroundParserResultsReadyEventArgs args)
- {
- using (SynchronizeMainThreadState())
- {
- ResultsReady?.Invoke(this, args);
- }
- }
-
- private abstract class ThreadStateBase
- {
-#if DEBUG
- private int _id = -1;
-#endif
- protected ThreadStateBase()
- {
- }
-
- [Conditional("DEBUG")]
- protected void SetThreadId(int id)
- {
-#if DEBUG
- _id = id;
-#endif
- }
-
- [Conditional("DEBUG")]
- protected void EnsureOnThread()
- {
-#if DEBUG
- Debug.Assert(_id != -1, "SetThreadId was never called!");
- Debug.Assert(Thread.CurrentThread.ManagedThreadId == _id, "Called from an unexpected thread!");
-#endif
- }
-
- [Conditional("DEBUG")]
- protected void EnsureNotOnThread()
- {
-#if DEBUG
- Debug.Assert(_id != -1, "SetThreadId was never called!");
- Debug.Assert(Thread.CurrentThread.ManagedThreadId != _id, "Called from an unexpected thread!");
-#endif
- }
- }
-
- private class MainThreadState : ThreadStateBase, IDisposable
- {
- private readonly CancellationTokenSource _cancelSource = new CancellationTokenSource();
- private readonly ManualResetEventSlim _hasParcel = new ManualResetEventSlim(false);
- private CancellationTokenSource _currentParcelCancelSource;
-
- private string _fileName;
- private readonly object _stateLock = new object();
- private IList _changes = new List();
-
- public MainThreadState(string fileName)
- {
- _fileName = fileName;
-
- SetThreadId(Thread.CurrentThread.ManagedThreadId);
- }
-
- public event EventHandler ResultsReady;
-
- public CancellationToken CancelToken
- {
- get { return _cancelSource.Token; }
- }
-
- public bool IsIdle
- {
- get
- {
- lock (_stateLock)
- {
- return _currentParcelCancelSource == null;
- }
- }
- }
-
- public void Cancel()
- {
- EnsureOnThread();
- _cancelSource.Cancel();
- }
-
- public IDisposable Lock()
- {
- Monitor.Enter(_stateLock);
- return new DisposableAction(() => Monitor.Exit(_stateLock));
- }
-
- public void QueueChange(ChangeReference change)
- {
- // Any thread can queue a change.
-
- lock (_stateLock)
- {
- // CurrentParcel token source is not null ==> There's a parse underway
- if (_currentParcelCancelSource != null)
- {
- _currentParcelCancelSource.Cancel();
- }
-
- _changes.Add(change);
- _hasParcel.Set();
- }
- }
-
- public WorkParcel GetParcel()
- {
- EnsureNotOnThread(); // Only the background thread can get a parcel
- _hasParcel.Wait(_cancelSource.Token);
- _hasParcel.Reset();
- lock (_stateLock)
- {
- // Create a cancellation source for this parcel
- _currentParcelCancelSource = new CancellationTokenSource();
-
- var changes = _changes;
- _changes = new List();
- return new WorkParcel(changes, _currentParcelCancelSource.Token);
- }
- }
-
- public void ReturnParcel(BackgroundParserResultsReadyEventArgs args)
- {
- lock (_stateLock)
- {
- // Clear the current parcel cancellation source
- if (_currentParcelCancelSource != null)
- {
- _currentParcelCancelSource.Dispose();
- _currentParcelCancelSource = null;
- }
-
- // If there are things waiting to be parsed, just don't fire the event because we're already out of date
- if (_changes.Any())
- {
- return;
- }
- }
- var handler = ResultsReady;
- if (handler != null)
- {
- handler(this, args);
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- if (_currentParcelCancelSource != null)
- {
- _currentParcelCancelSource.Dispose();
- _currentParcelCancelSource = null;
- }
- _cancelSource.Dispose();
- _hasParcel.Dispose();
- }
- }
- }
-
- private class BackgroundThread : ThreadStateBase
- {
- private readonly string _filePath;
- private readonly string _relativeFilePath;
- private readonly string _projectDirectory;
- private MainThreadState _main;
- private Thread _backgroundThread;
- private CancellationToken _shutdownToken;
- private RazorProjectEngine _projectEngine;
- private RazorSyntaxTree _currentSyntaxTree;
- private IList _previouslyDiscarded = new List();
-
- public BackgroundThread(MainThreadState main, RazorProjectEngine projectEngine, string filePath, string projectDirectory)
- {
- // Run on MAIN thread!
- _main = main;
- _shutdownToken = _main.CancelToken;
- _projectEngine = projectEngine;
- _filePath = filePath;
- _relativeFilePath = GetNormalizedRelativeFilePath(filePath, projectDirectory);
- _projectDirectory = projectDirectory;
- _backgroundThread = new Thread(WorkerLoop);
- SetThreadId(_backgroundThread.ManagedThreadId);
- }
-
- // **** ANY THREAD ****
- public void Start()
- {
- _backgroundThread.Start();
- }
-
- // **** BACKGROUND THREAD ****
- private void WorkerLoop()
- {
- try
- {
- EnsureOnThread();
-
- while (!_shutdownToken.IsCancellationRequested)
- {
- // Grab the parcel of work to do
- var parcel = _main.GetParcel();
- if (parcel.Changes.Any())
- {
- try
- {
- BackgroundParserResultsReadyEventArgs args = null;
- using (var linkedCancel = CancellationTokenSource.CreateLinkedTokenSource(_shutdownToken, parcel.CancelToken))
- {
- if (!linkedCancel.IsCancellationRequested)
- {
- // Collect ALL changes
- List allChanges;
-
- if (_previouslyDiscarded != null)
- {
- allChanges = Enumerable.Concat(_previouslyDiscarded, parcel.Changes).ToList();
- }
- else
- {
- allChanges = parcel.Changes.ToList();
- }
-
- var finalChange = allChanges.Last();
-
- var results = ParseChange(finalChange.Snapshot, linkedCancel.Token);
-
- if (results != null && !linkedCancel.IsCancellationRequested)
- {
- // Clear discarded changes list
- _previouslyDiscarded = null;
-
- _currentSyntaxTree = results.GetSyntaxTree();
-
- // Build Arguments
- args = new BackgroundParserResultsReadyEventArgs(finalChange, results);
- }
- else
- {
- // Parse completed but we were cancelled in the mean time. Add these to the discarded changes set
- _previouslyDiscarded = allChanges;
- }
- }
- }
- if (args != null)
- {
- _main.ReturnParcel(args);
- }
- }
- catch (OperationCanceledException)
- {
- }
- }
- else
- {
- Thread.Yield();
- }
- }
- }
- catch (OperationCanceledException)
- {
- // Do nothing. Just shut down.
- }
- finally
- {
- // Clean up main thread resources
- _main.Dispose();
- }
- }
-
- private RazorCodeDocument ParseChange(ITextSnapshot snapshot, CancellationToken token)
- {
- EnsureOnThread();
-
- var projectItem = new TextSnapshotProjectItem(snapshot, _projectDirectory, _relativeFilePath, _filePath);
- var codeDocument = _projectEngine.ProcessDesignTime(projectItem);
-
- return codeDocument;
- }
-
- private string GetNormalizedRelativeFilePath(string filePath, string projectDirectory)
- {
- if (filePath.StartsWith(projectDirectory, StringComparison.OrdinalIgnoreCase))
- {
- filePath = filePath.Substring(projectDirectory.Length);
- }
-
- if (filePath.Length > 1)
- {
- filePath = filePath.Replace('\\', '/');
-
- if (filePath[0] != '/')
- {
- filePath = "/" + filePath;
- }
- }
-
- return filePath;
- }
- }
-
- private class WorkParcel
- {
- public WorkParcel(IList changes, CancellationToken cancelToken)
- {
- Changes = changes;
- CancelToken = cancelToken;
- }
-
- public CancellationToken CancelToken { get; }
-
- public IList Changes { get; }
- }
-
- internal class ChangeReference
- {
- public ChangeReference(SourceChange change, ITextSnapshot snapshot)
- {
- Change = change;
- Snapshot = snapshot;
- }
-
- public SourceChange Change { get; }
-
- public ITextSnapshot Snapshot { get; }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParserResultsReadyEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParserResultsReadyEventArgs.cs
deleted file mode 100644
index ecb9cef76ed3..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParserResultsReadyEventArgs.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-using static Microsoft.VisualStudio.Editor.Razor.BackgroundParser;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class BackgroundParserResultsReadyEventArgs : EventArgs
- {
- public BackgroundParserResultsReadyEventArgs(ChangeReference edit, RazorCodeDocument codeDocument)
- {
- ChangeReference = edit;
- CodeDocument = codeDocument;
- }
-
- public ChangeReference ChangeReference { get; }
-
- public RazorCodeDocument CodeDocument { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs
deleted file mode 100644
index 255923132961..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public enum BlockKind
- {
- // Code
- Statement,
- Directive,
- Functions,
- Expression,
- Helper,
-
- // Markup
- Markup,
- Section,
- Template,
-
- // Special
- Comment,
- Tag,
-
- HtmlComment
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs
deleted file mode 100644
index 4de857b9667d..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs
+++ /dev/null
@@ -1,350 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Text;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Operations;
-using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer;
-using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- ///
- /// This class is responsible for handling situations where Roslyn and the HTML editor cannot auto-indent Razor code.
- ///
- ///
- /// Attempting to insert a newline (pipe indicates the cursor):
- /// @{ |}
- /// Should result in the text buffer looking like the following:
- /// @{
- /// |
- /// }
- /// This is also true for directive block scenarios.
- ///
- internal class BraceSmartIndenter : IDisposable
- {
- private readonly ForegroundDispatcher _dispatcher;
- private readonly ITextBuffer _textBuffer;
- private readonly VisualStudioDocumentTracker _documentTracker;
- private readonly TextBufferCodeDocumentProvider _codeDocumentProvider;
- private readonly IEditorOperationsFactoryService _editorOperationsFactory;
- private readonly StringBuilder _indentBuilder = new StringBuilder();
- private BraceIndentationContext _context;
-
- // Internal for testing
- internal BraceSmartIndenter()
- {
- }
-
- public BraceSmartIndenter(
- ForegroundDispatcher dispatcher,
- VisualStudioDocumentTracker documentTracker,
- TextBufferCodeDocumentProvider codeDocumentProvider,
- IEditorOperationsFactoryService editorOperationsFactory)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (documentTracker == null)
- {
- throw new ArgumentNullException(nameof(documentTracker));
- }
-
- if (codeDocumentProvider == null)
- {
- throw new ArgumentNullException(nameof(codeDocumentProvider));
- }
-
- if (editorOperationsFactory == null)
- {
- throw new ArgumentNullException(nameof(editorOperationsFactory));
- }
-
- _dispatcher = dispatcher;
- _documentTracker = documentTracker;
- _codeDocumentProvider = codeDocumentProvider;
- _editorOperationsFactory = editorOperationsFactory;
- _textBuffer = _documentTracker.TextBuffer;
- _textBuffer.Changed += TextBuffer_OnChanged;
- _textBuffer.PostChanged += TextBuffer_OnPostChanged;
- }
-
- public void Dispose()
- {
- _dispatcher.AssertForegroundThread();
-
- _textBuffer.Changed -= TextBuffer_OnChanged;
- _textBuffer.PostChanged -= TextBuffer_OnPostChanged;
- }
-
- // Internal for testing
- internal void TriggerSmartIndent(ITextView textView)
- {
- // This forces the smart indent. For example attempting to enter a newline between the functions directive:
- // @functions {} will not auto-indent in between the braces unless we forcefully move to end of line.
- var editorOperations = _editorOperationsFactory.GetEditorOperations(textView);
- editorOperations.MoveToEndOfLine(false);
- }
-
- // Internal for testing
- internal void TextBuffer_OnChanged(object sender, TextContentChangedEventArgs args)
- {
- _dispatcher.AssertForegroundThread();
-
- if (!args.TextChangeOccurred(out var changeInformation))
- {
- return;
- }
-
- var newText = changeInformation.newText;
- if (!_codeDocumentProvider.TryGetFromBuffer(_documentTracker.TextBuffer, out var codeDocument))
- {
- // Parse not available.
- return;
- }
-
- var syntaxTree = codeDocument.GetSyntaxTree();
- if (TryCreateIndentationContext(changeInformation.firstChange.NewPosition, newText.Length, newText, syntaxTree, _documentTracker, out var context))
- {
- _context = context;
- }
- }
-
- private void TextBuffer_OnPostChanged(object sender, EventArgs e)
- {
- _dispatcher.AssertForegroundThread();
-
- var context = _context;
- _context = null;
-
- if (context != null)
- {
- // Save the current caret position
- var textView = context.FocusedTextView;
- var caret = textView.Caret.Position.BufferPosition;
- var textViewBuffer = textView.TextBuffer;
- var indent = CalculateIndent(textViewBuffer, context.ChangePosition);
-
- // Current state, pipe is cursor:
- // @{
- // |}
-
- // Insert the completion text, i.e. "\r\n "
- InsertIndent(caret.Position, indent, textViewBuffer);
-
- // @{
- //
- // |}
-
- // Place the caret inbetween the braces (before our indent).
- RestoreCaretTo(caret.Position, textView);
-
- // @{
- // |
- // }
-
- // For Razor metacode cases the editor's smart indent wont kick in automatically.
- TriggerSmartIndent(textView);
-
- // @{
- // |
- // }
- }
- }
-
- private string CalculateIndent(ITextBuffer buffer, int from)
- {
- // Get the line text of the block start
- var currentSnapshotPoint = new SnapshotPoint(buffer.CurrentSnapshot, from);
- var line = buffer.CurrentSnapshot.GetLineFromPosition(currentSnapshotPoint);
- var lineText = line.GetText();
-
- // Gather up the indent from the start block
- _indentBuilder.Append(line.GetLineBreakText());
- foreach (var ch in lineText)
- {
- if (!char.IsWhiteSpace(ch))
- {
- break;
- }
- _indentBuilder.Append(ch);
- }
-
- var indent = _indentBuilder.ToString();
- _indentBuilder.Clear();
-
- return indent;
- }
-
- // Internal for testing
- internal static void InsertIndent(int insertLocation, string indent, ITextBuffer textBuffer)
- {
- var edit = textBuffer.CreateEdit();
- edit.Insert(insertLocation, indent);
- edit.Apply();
- }
-
- // Internal for testing
- internal static void RestoreCaretTo(int caretPosition, ITextView textView)
- {
- var currentSnapshotPoint = new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, caretPosition);
- textView.Caret.MoveTo(currentSnapshotPoint);
- }
-
- // Internal for testing
- internal static bool TryCreateIndentationContext(
- int changePosition,
- int changeLength,
- string finalText,
- RazorSyntaxTree syntaxTree,
- VisualStudioDocumentTracker documentTracker,
- out BraceIndentationContext context)
- {
- var focusedTextView = documentTracker.GetFocusedTextView();
- if (focusedTextView != null && ParserHelpers.IsNewLine(finalText))
- {
- if (!AtApplicableRazorBlock(changePosition, syntaxTree))
- {
- context = null;
- return false;
- }
-
- var currentSnapshot = documentTracker.TextBuffer.CurrentSnapshot;
- var preChangeLineSnapshot = currentSnapshot.GetLineFromPosition(changePosition);
-
- // Handle the case where the \n comes through separately from the \r and the position
- // on the line is beyond what the GetText call above gives back.
- var linePosition = Math.Min(preChangeLineSnapshot.Length, changePosition - preChangeLineSnapshot.Start) - 1;
-
- if (AfterOpeningBrace(linePosition, preChangeLineSnapshot))
- {
- var afterChangePosition = changePosition + changeLength;
- var afterChangeLineSnapshot = currentSnapshot.GetLineFromPosition(afterChangePosition);
- var afterChangeLinePosition = afterChangePosition - afterChangeLineSnapshot.Start;
-
- if (BeforeClosingBrace(afterChangeLinePosition, afterChangeLineSnapshot))
- {
- context = new BraceIndentationContext(focusedTextView, changePosition);
- return true;
- }
- }
- }
-
- context = null;
- return false;
- }
-
- // Internal for testing
- internal static bool AtApplicableRazorBlock(int changePosition, RazorSyntaxTree syntaxTree)
- {
- // Our goal here is to return true when we're acting on code blocks that have all
- // whitespace content and are surrounded by metacode.
- // Some examples:
- // @functions { |}
- // @section foo { |}
- // @{ |}
-
- var change = new SourceChange(changePosition, 0, string.Empty);
- var owner = syntaxTree.Root.LocateOwner(change);
-
- if (IsUnlinkedSpan(owner))
- {
- return false;
- }
-
- if (SurroundedByInvalidContent(owner))
- {
- return false;
- }
-
- if (ContainsInvalidContent(owner))
- {
- return false;
- }
-
- // Indentable content inside of a code block.
- return true;
- }
-
- // Internal for testing
- internal static bool ContainsInvalidContent(Span owner)
- {
- // We only support whitespace based content. Any non-whitespace content is an unkonwn to us
- // in regards to indentation.
- for (var i = 0; i < owner.Tokens.Count; i++)
- {
- if (!string.IsNullOrWhiteSpace(owner.Tokens[i].Content))
- {
- return true;
- }
- }
-
- return false;
- }
-
- // Internal for testing
- internal static bool IsUnlinkedSpan(Span owner)
- {
- return owner == null ||
- owner.Next == null ||
- owner.Previous == null;
- }
-
- // Internal for testing
- internal static bool SurroundedByInvalidContent(Span owner)
- {
- return owner.Next.Kind != SpanKindInternal.MetaCode ||
- owner.Previous.Kind != SpanKindInternal.MetaCode;
- }
-
- internal static bool BeforeClosingBrace(int linePosition, ITextSnapshotLine lineSnapshot)
- {
- var lineText = lineSnapshot.GetText();
- for (; linePosition < lineSnapshot.Length; linePosition++)
- {
- if (!char.IsWhiteSpace(lineText[linePosition]))
- {
- break;
- }
- }
-
- var beforeClosingBrace = linePosition < lineSnapshot.Length && lineText[linePosition] == '}';
- return beforeClosingBrace;
- }
-
- internal static bool AfterOpeningBrace(int linePosition, ITextSnapshotLine lineSnapshot)
- {
- var lineText = lineSnapshot.GetText();
- for (; linePosition >= 0; linePosition--)
- {
- if (!char.IsWhiteSpace(lineText[linePosition]))
- {
- break;
- }
- }
-
- var afterClosingBrace = linePosition >= 0 && lineText[linePosition] == '{';
- return afterClosingBrace;
- }
-
- internal class BraceIndentationContext
- {
- public BraceIndentationContext(ITextView focusedTextView, int changePosition)
- {
- FocusedTextView = focusedTextView;
- ChangePosition = changePosition;
- }
-
- public ITextView FocusedTextView { get; }
-
- public int ChangePosition { get; }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs
deleted file mode 100644
index 691181df6953..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal abstract class BraceSmartIndenterFactory : ILanguageService
- {
- public abstract BraceSmartIndenter Create(VisualStudioDocumentTracker documentTracker);
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs
deleted file mode 100644
index 1d16e0f0822c..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.ObjectModel;
-using Microsoft.VisualStudio.Text.Projection;
-
-namespace Microsoft.VisualStudio.Text
-{
- internal static class BufferGraphExtensions
- {
- public static Collection GetRazorBuffers(this IBufferGraph bufferGraph)
- {
- if (bufferGraph == null)
- {
- throw new ArgumentNullException(nameof(bufferGraph));
- }
-
- return bufferGraph.GetTextBuffers(TextBufferExtensions.IsRazorBuffer);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs
deleted file mode 100644
index dc066c8fce8c..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public struct ClassifiedSpan
- {
- public ClassifiedSpan(SourceSpan span, SourceSpan blockSpan, SpanKind spanKind, BlockKind blockKind, AcceptedCharacters acceptedCharacters)
- {
- Span = span;
- BlockSpan = blockSpan;
- SpanKind = spanKind;
- BlockKind = blockKind;
- AcceptedCharacters = acceptedCharacters;
- }
-
- public AcceptedCharacters AcceptedCharacters { get; }
-
- public BlockKind BlockKind { get; }
-
- public SourceSpan BlockSpan { get; }
-
- public SourceSpan Span { get; }
-
- public SpanKind SpanKind { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs
deleted file mode 100644
index ad28406a15a6..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public sealed class ContextChangeEventArgs : EventArgs
- {
- public ContextChangeEventArgs(ContextChangeKind kind)
- {
- Kind = kind;
- }
-
- public ContextChangeKind Kind { get; }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs
deleted file mode 100644
index 2a9509967638..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public enum ContextChangeKind
- {
- ProjectChanged,
- EditorSettingsChanged,
- TagHelpersChanged,
- ImportsChanged,
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs
deleted file mode 100644
index 0b89592c56d2..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text.Operations;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultBraceSmartIndenterFactory : BraceSmartIndenterFactory
- {
- private readonly IEditorOperationsFactoryService _editorOperationsFactory;
- private readonly ForegroundDispatcher _dispatcher;
- private readonly TextBufferCodeDocumentProvider _codeDocumentProvider;
-
- public DefaultBraceSmartIndenterFactory(
- ForegroundDispatcher dispatcher,
- TextBufferCodeDocumentProvider codeDocumentProvider,
- IEditorOperationsFactoryService editorOperationsFactory)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (codeDocumentProvider == null)
- {
- throw new ArgumentNullException(nameof(codeDocumentProvider));
- }
-
- if (editorOperationsFactory == null)
- {
- throw new ArgumentNullException(nameof(editorOperationsFactory));
- }
-
- _dispatcher = dispatcher;
- _codeDocumentProvider = codeDocumentProvider;
- _editorOperationsFactory = editorOperationsFactory;
- }
-
- public override BraceSmartIndenter Create(VisualStudioDocumentTracker documentTracker)
- {
- if (documentTracker == null)
- {
- throw new ArgumentNullException(nameof(documentTracker));
- }
-
- _dispatcher.AssertForegroundThread();
-
- var braceSmartIndenter = new BraceSmartIndenter(_dispatcher, documentTracker, _codeDocumentProvider, _editorOperationsFactory);
-
- return braceSmartIndenter;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs
deleted file mode 100644
index 2ca82e3cb535..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text.Operations;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(BraceSmartIndenterFactory), RazorLanguage.Name, ServiceLayer.Default)]
- internal class DefaultBraceSmartIndenterFactoryFactory : ILanguageServiceFactory
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly TextBufferCodeDocumentProvider _codeDocumentProvider;
- private readonly IEditorOperationsFactoryService _editorOperationsFactory;
-
- [ImportingConstructor]
- public DefaultBraceSmartIndenterFactoryFactory(
- ForegroundDispatcher foregroundDispatcher,
- TextBufferCodeDocumentProvider codeDocumentProvider,
- IEditorOperationsFactoryService editorOperationsFactory)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (codeDocumentProvider == null)
- {
- throw new ArgumentNullException(nameof(codeDocumentProvider));
- }
-
- if (editorOperationsFactory == null)
- {
- throw new ArgumentNullException(nameof(editorOperationsFactory));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _codeDocumentProvider = codeDocumentProvider;
- _editorOperationsFactory = editorOperationsFactory;
- }
-
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- return new DefaultBraceSmartIndenterFactory(_foregroundDispatcher, _codeDocumentProvider, _editorOperationsFactory);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs
deleted file mode 100644
index 61fafc8a847a..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorCodeDocumentProvider))]
- internal class DefaultCodeDocumentProvider : RazorCodeDocumentProvider
- {
- private readonly RazorTextBufferProvider _bufferProvider;
- private readonly TextBufferCodeDocumentProvider _codeDocumentProvider;
-
- [ImportingConstructor]
- public DefaultCodeDocumentProvider(
- RazorTextBufferProvider bufferProvider,
- TextBufferCodeDocumentProvider codeDocumentProvider)
- {
- if (bufferProvider == null)
- {
- throw new ArgumentNullException(nameof(bufferProvider));
- }
-
- if (codeDocumentProvider == null)
- {
- throw new ArgumentNullException(nameof(codeDocumentProvider));
- }
-
- _bufferProvider = bufferProvider;
- _codeDocumentProvider = codeDocumentProvider;
- }
-
- public override bool TryGetFromDocument(TextDocument document, out RazorCodeDocument codeDocument)
- {
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- if (!_bufferProvider.TryGetFromDocument(document, out var textBuffer))
- {
- // Could not find a Razor buffer associated with the document.
- codeDocument = null;
- return false;
- }
-
- if (_codeDocumentProvider.TryGetFromBuffer(textBuffer, out codeDocument))
- {
- return true;
- }
-
- // A Razor code document has not yet been associated with the buffer yet.
- codeDocument = null;
- return false;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs
deleted file mode 100644
index cba58513084b..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(EditorSettingsManager))]
- internal class DefaultEditorSettingsManager : EditorSettingsManager
- {
- public override event EventHandler Changed;
-
- private readonly object SettingsAccessorLock = new object();
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private EditorSettings _settings;
-
- [ImportingConstructor]
- public DefaultEditorSettingsManager(ForegroundDispatcher foregroundDispatcher)
- {
- _foregroundDispatcher = foregroundDispatcher;
- _settings = EditorSettings.Default;
- }
-
- public override EditorSettings Current
- {
- get
- {
- lock (SettingsAccessorLock)
- {
- return _settings;
- }
- }
- }
-
- public override void Update(EditorSettings updatedSettings)
- {
- if (updatedSettings == null)
- {
- throw new ArgumentNullException(nameof(updatedSettings));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (SettingsAccessorLock)
- {
- if (!_settings.Equals(updatedSettings))
- {
- _settings = updatedSettings;
- OnChanged();
- }
- }
- }
-
- private void OnChanged()
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- var args = new EditorSettingsChangedEventArgs(Current);
- Changed?.Invoke(this, args);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs
deleted file mode 100644
index b095cfdbb7dd..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Editor.Razor.Documents;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultImportDocumentManager : ImportDocumentManager
- {
- private readonly FileChangeTrackerFactory _fileChangeTrackerFactory;
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly ErrorReporter _errorReporter;
- private readonly Dictionary _importTrackerCache;
-
- public override event EventHandler Changed;
-
- public DefaultImportDocumentManager(
- ForegroundDispatcher foregroundDispatcher,
- ErrorReporter errorReporter,
- FileChangeTrackerFactory fileChangeTrackerFactory)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (errorReporter == null)
- {
- throw new ArgumentNullException(nameof(errorReporter));
- }
-
- if (fileChangeTrackerFactory == null)
- {
- throw new ArgumentNullException(nameof(fileChangeTrackerFactory));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _errorReporter = errorReporter;
- _fileChangeTrackerFactory = fileChangeTrackerFactory;
- _importTrackerCache = new Dictionary(StringComparer.OrdinalIgnoreCase);
- }
-
- public override void OnSubscribed(VisualStudioDocumentTracker tracker)
- {
- if (tracker == null)
- {
- throw new ArgumentNullException(nameof(tracker));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- var imports = GetImportItems(tracker);
- foreach (var import in imports)
- {
- var importFilePath = import.PhysicalPath;
- Debug.Assert(importFilePath != null);
-
- if (!_importTrackerCache.TryGetValue(importFilePath, out var importTracker))
- {
- // First time seeing this import. Start tracking it.
- var fileChangeTracker = _fileChangeTrackerFactory.Create(importFilePath);
- importTracker = new ImportTracker(fileChangeTracker);
- _importTrackerCache[importFilePath] = importTracker;
-
- fileChangeTracker.Changed += FileChangeTracker_Changed;
- fileChangeTracker.StartListening();
- }
-
- importTracker.AssociatedDocuments.Add(tracker.FilePath);
- }
- }
-
- public override void OnUnsubscribed(VisualStudioDocumentTracker tracker)
- {
- if (tracker == null)
- {
- throw new ArgumentNullException(nameof(tracker));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- var imports = GetImportItems(tracker);
- foreach (var import in imports)
- {
- var importFilePath = import.PhysicalPath;
- Debug.Assert(importFilePath != null);
-
- if (_importTrackerCache.TryGetValue(importFilePath, out var importTracker))
- {
- importTracker.AssociatedDocuments.Remove(tracker.FilePath);
-
- if (importTracker.AssociatedDocuments.Count == 0)
- {
- // There are no open documents that care about this import. We no longer need to track it.
- importTracker.FileChangeTracker.StopListening();
- _importTrackerCache.Remove(importFilePath);
- }
- }
- }
- }
-
- private IEnumerable GetImportItems(VisualStudioDocumentTracker tracker)
- {
- var projectEngine = tracker.ProjectSnapshot.GetProjectEngine();
- var trackerItem = projectEngine.FileSystem.GetItem(tracker.FilePath);
- var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault();
-
- // There should always be an import feature unless someone has misconfigured their RazorProjectEngine.
- // In that case once we attempt to parse the Razor file we'll explode and give the a user a decent
- // error message; for now, lets just be extra protective and assume 0 imports to not give a bad error.
- var importItems = importFeature?.GetImports(trackerItem) ?? Enumerable.Empty();
- var physicalImports = importItems.Where(import => import.FilePath != null);
-
- return physicalImports;
- }
-
- private void OnChanged(ImportTracker importTracker, FileChangeKind changeKind)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- if (Changed == null)
- {
- return;
- }
-
- var args = new ImportChangedEventArgs(importTracker.FilePath, changeKind, importTracker.AssociatedDocuments);
- Changed.Invoke(this, args);
- }
-
- private void FileChangeTracker_Changed(object sender, FileChangeEventArgs args)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_importTrackerCache.TryGetValue(args.FilePath, out var importTracker))
- {
- OnChanged(importTracker, args.Kind);
- }
- }
-
- private class ImportTracker
- {
- public ImportTracker(FileChangeTracker fileChangeTracker)
- {
- FileChangeTracker = fileChangeTracker;
- AssociatedDocuments = new HashSet(StringComparer.OrdinalIgnoreCase);
- }
-
- public string FilePath => FileChangeTracker.FilePath;
-
- public FileChangeTracker FileChangeTracker { get; }
-
- public HashSet AssociatedDocuments { get; }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs
deleted file mode 100644
index 1a0596d25e1d..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Editor.Razor.Documents;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(ImportDocumentManager), RazorLanguage.Name, ServiceLayer.Default)]
- internal class DefaultImportDocumentManagerFactory : ILanguageServiceFactory
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
-
- [ImportingConstructor]
- public DefaultImportDocumentManagerFactory(ForegroundDispatcher foregroundDispatcher)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- }
-
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- var errorReporter = languageServices.WorkspaceServices.GetRequiredService();
- var fileChangeTrackerFactory = languageServices.WorkspaceServices.GetRequiredService();
-
- return new DefaultImportDocumentManager(_foregroundDispatcher, errorReporter, fileChangeTrackerFactory);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProvider.cs
deleted file mode 100644
index 95f01de20137..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProvider.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultProjectPathProvider : ProjectPathProvider
- {
- private readonly TextBufferProjectService _projectService;
-
- public DefaultProjectPathProvider(TextBufferProjectService projectService)
- {
- if (projectService == null)
- {
- throw new ArgumentNullException(nameof(projectService));
- }
-
- _projectService = projectService;
- }
-
- public override bool TryGetProjectPath(ITextBuffer textBuffer, out string filePath)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- var project = _projectService.GetHostProject(textBuffer);
- if (project == null)
- {
- filePath = null;
- return false;
- }
-
- filePath = _projectService.GetProjectPath(project);
- return true;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProviderFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProviderFactory.cs
deleted file mode 100644
index f425fd89d54a..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectPathProviderFactory.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportWorkspaceServiceFactory(typeof(ProjectPathProvider), ServiceLayer.Default)]
- internal class DefaultProjectPathProviderFactory : IWorkspaceServiceFactory
- {
- private readonly TextBufferProjectService _projectService;
-
- [ImportingConstructor]
- public DefaultProjectPathProviderFactory(TextBufferProjectService projectService)
- {
- if (projectService == null)
- {
- throw new ArgumentNullException(nameof(projectService));
- }
-
- _projectService = projectService;
- }
-
- public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
- {
- if (workspaceServices == null)
- {
- throw new ArgumentNullException(nameof(workspaceServices));
- }
-
- return new DefaultProjectPathProvider(_projectService);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs
deleted file mode 100644
index 7ceda03678a5..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Diagnostics;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorDocumentManager))]
- internal class DefaultRazorDocumentManager : RazorDocumentManager
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly RazorEditorFactoryService _editorFactoryService;
-
- [ImportingConstructor]
- public DefaultRazorDocumentManager(
- ForegroundDispatcher dispatcher,
- RazorEditorFactoryService editorFactoryService)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (editorFactoryService == null)
- {
- throw new ArgumentNullException(nameof(editorFactoryService));
- }
-
- _foregroundDispatcher = dispatcher;
- _editorFactoryService = editorFactoryService;
- }
-
- public override void OnTextViewOpened(ITextView textView, IEnumerable subjectBuffers)
- {
- if (textView == null)
- {
- throw new ArgumentNullException(nameof(textView));
- }
-
- if (subjectBuffers == null)
- {
- throw new ArgumentNullException(nameof(subjectBuffers));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- foreach (var textBuffer in subjectBuffers)
- {
- if (!textBuffer.IsRazorBuffer())
- {
- continue;
- }
-
- if (!_editorFactoryService.TryGetDocumentTracker(textBuffer, out var documentTracker) ||
- !(documentTracker is DefaultVisualStudioDocumentTracker tracker))
- {
- Debug.Fail("Tracker should always be available given our expectations of the VS workflow.");
- return;
- }
-
- tracker.AddTextView(textView);
-
- if (documentTracker.TextViews.Count == 1)
- {
- tracker.Subscribe();
- }
- }
- }
-
- public override void OnTextViewClosed(ITextView textView, IEnumerable subjectBuffers)
- {
- if (textView == null)
- {
- throw new ArgumentNullException(nameof(textView));
- }
-
- if (subjectBuffers == null)
- {
- throw new ArgumentNullException(nameof(subjectBuffers));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- // This means a Razor buffer has be detached from this ITextView or the ITextView is closing. Since we keep a
- // list of all of the open text views for each text buffer, we need to update the tracker.
- //
- // Notice that this method is called *after* changes are applied to the text buffer(s). We need to check every
- // one of them for a tracker because the content type could have changed.
- foreach (var textBuffer in subjectBuffers)
- {
- DefaultVisualStudioDocumentTracker documentTracker;
- if (textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out documentTracker))
- {
- documentTracker.RemoveTextView(textView);
-
- if (documentTracker.TextViews.Count == 0)
- {
- documentTracker.Unsubscribe();
- }
- }
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs
deleted file mode 100644
index 66f624d02d20..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel.Composition;
-using System.Diagnostics;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorEditorFactoryService))]
- internal class DefaultRazorEditorFactoryService : RazorEditorFactoryService
- {
- private static readonly object RazorTextBufferInitializationKey = new object();
- private readonly VisualStudioWorkspaceAccessor _workspaceAccessor;
-
- [ImportingConstructor]
- public DefaultRazorEditorFactoryService(VisualStudioWorkspaceAccessor workspaceAccessor)
- {
- if (workspaceAccessor == null)
- {
- throw new ArgumentNullException(nameof(workspaceAccessor));
- }
-
- _workspaceAccessor = workspaceAccessor;
- }
-
- public override bool TryGetDocumentTracker(ITextBuffer textBuffer, out VisualStudioDocumentTracker documentTracker)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (!textBuffer.IsRazorBuffer())
- {
- documentTracker = null;
- return false;
- }
-
- var textBufferInitialized = TryInitializeTextBuffer(textBuffer);
- if (!textBufferInitialized)
- {
- documentTracker = null;
- return false;
- }
-
- if (!textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out documentTracker))
- {
- Debug.Fail("Document tracker should have been stored on the text buffer during initialization.");
- return false;
- }
-
- return true;
- }
-
- public override bool TryGetParser(ITextBuffer textBuffer, out VisualStudioRazorParser parser)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (!textBuffer.IsRazorBuffer())
- {
- parser = null;
- return false;
- }
-
- var textBufferInitialized = TryInitializeTextBuffer(textBuffer);
- if (!textBufferInitialized)
- {
- parser = null;
- return false;
- }
-
- if (!textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out parser))
- {
- Debug.Fail("Parser should have been stored on the text buffer during initialization.");
- return false;
- }
-
- return true;
- }
-
- internal override bool TryGetSmartIndenter(ITextBuffer textBuffer, out BraceSmartIndenter braceSmartIndenter)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (!textBuffer.IsRazorBuffer())
- {
- braceSmartIndenter = null;
- return false;
- }
-
- var textBufferInitialized = TryInitializeTextBuffer(textBuffer);
- if (!textBufferInitialized)
- {
- braceSmartIndenter = null;
- return false;
- }
-
- if (!textBuffer.Properties.TryGetProperty(typeof(BraceSmartIndenter), out braceSmartIndenter))
- {
- Debug.Fail("Brace smart indenter should have been stored on the text buffer during initialization.");
- return false;
- }
-
- return true;
- }
-
- // Internal for testing
- internal bool TryInitializeTextBuffer(ITextBuffer textBuffer)
- {
- if (textBuffer.Properties.ContainsProperty(RazorTextBufferInitializationKey))
- {
- // Buffer already initialized.
- return true;
- }
-
- if (!_workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace))
- {
- // Could not locate workspace for given text buffer.
- return false;
- }
-
- var razorLanguageServices = workspace.Services.GetLanguageServices(RazorLanguage.Name);
- var documentTrackerFactory = razorLanguageServices.GetRequiredService();
- var parserFactory = razorLanguageServices.GetRequiredService();
- var braceSmartIndenterFactory = razorLanguageServices.GetRequiredService();
-
- var tracker = documentTrackerFactory.Create(textBuffer);
- textBuffer.Properties[typeof(VisualStudioDocumentTracker)] = tracker;
-
- var parser = parserFactory.Create(tracker);
- textBuffer.Properties[typeof(VisualStudioRazorParser)] = parser;
-
- var braceSmartIndenter = braceSmartIndenterFactory.Create(tracker);
- textBuffer.Properties[typeof(BraceSmartIndenter)] = braceSmartIndenter;
-
- textBuffer.Properties.AddProperty(RazorTextBufferInitializationKey, RazorTextBufferInitializationKey);
-
- return true;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs
deleted file mode 100644
index f69274fa1502..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
-using Microsoft.VisualStudio.Text;
-using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorIndentationFactsService))]
- internal class DefaultRazorIndentationFactsService : RazorIndentationFactsService
- {
- // This method dives down a syntax tree looking for open curly braces, every time
- // it finds one it increments its indent until it finds the provided "line".
- //
- // Examples:
- // @{
- // Hello World
- // }
- // Asking for desired indentation of the @{ or } lines should result in a desired indentation of 4.
- //
- //
- // @{
- // Hello World
- // }
- //
- // Asking for desired indentation of the @{ or } lines should result in a desired indentation of 8.
- public override int? GetDesiredIndentation(
- RazorSyntaxTree syntaxTree,
- ITextSnapshot syntaxTreeSnapshot,
- ITextSnapshotLine line,
- int indentSize,
- int tabSize)
- {
- if (syntaxTree == null)
- {
- throw new ArgumentNullException(nameof(syntaxTree));
- }
-
- if (syntaxTreeSnapshot == null)
- {
- throw new ArgumentNullException(nameof(syntaxTreeSnapshot));
- }
-
- if (line == null)
- {
- throw new ArgumentNullException(nameof(line));
- }
-
- if (indentSize < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(indentSize));
- }
-
- if (tabSize < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(tabSize));
- }
-
- var previousLineEndIndex = GetPreviousLineEndIndex(syntaxTreeSnapshot, line);
- var simulatedChange = new SourceChange(previousLineEndIndex, 0, string.Empty);
- var owningSpan = syntaxTree.Root.LocateOwner(simulatedChange);
- if (owningSpan == null || owningSpan.Kind == SpanKindInternal.Code)
- {
- // Example,
- // @{\n
- // ^ - The newline here is a code span and we should just let the default c# editor take care of indentation.
-
- return null;
- }
-
- int? desiredIndentation = null;
- SyntaxTreeNode owningChild = owningSpan;
- while (owningChild.Parent != null)
- {
- var owningParent = owningChild.Parent;
- for (var i = 0; i < owningParent.Children.Count; i++)
- {
- var currentChild = owningParent.Children[i];
- if (IsCSharpOpenCurlyBrace(currentChild))
- {
- var lineText = line.Snapshot.GetLineFromLineNumber(currentChild.Start.LineIndex).GetText();
- desiredIndentation = GetIndentLevelOfLine(lineText, tabSize) + indentSize;
- }
-
- if (currentChild == owningChild)
- {
- break;
- }
- }
-
- if (desiredIndentation.HasValue)
- {
- return desiredIndentation;
- }
-
- owningChild = owningParent;
- }
-
- // Couldn't determine indentation
- return null;
- }
-
- // Internal for testing
- internal int GetIndentLevelOfLine(string line, int tabSize)
- {
- var indentLevel = 0;
-
- foreach (var c in line)
- {
- if (!char.IsWhiteSpace(c))
- {
- break;
- }
- else if (c == '\t')
- {
- indentLevel += tabSize;
- }
- else
- {
- indentLevel++;
- }
- }
-
- return indentLevel;
- }
-
- // Internal for testing
- internal static int GetPreviousLineEndIndex(ITextSnapshot syntaxTreeSnapshot, ITextSnapshotLine line)
- {
- var previousLine = line.Snapshot.GetLineFromLineNumber(line.LineNumber - 1);
- var trackingPoint = previousLine.Snapshot.CreateTrackingPoint(previousLine.End, PointTrackingMode.Negative);
- var previousLineEndIndex = trackingPoint.GetPosition(syntaxTreeSnapshot);
- return previousLineEndIndex;
- }
-
- // Internal for testing
- internal static bool IsCSharpOpenCurlyBrace(SyntaxTreeNode currentChild)
- {
- return currentChild is Span currentSpan &&
- currentSpan.Tokens.Count == 1 &&
- currentSpan.Tokens[0] is CSharpToken symbol &&
- symbol.Type == CSharpTokenType.LeftBrace;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs
deleted file mode 100644
index c5f3e2779a95..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorSyntaxFactsService))]
- internal class DefaultRazorSyntaxFactsService : RazorSyntaxFactsService
- {
- public override IReadOnlyList GetClassifiedSpans(RazorSyntaxTree syntaxTree)
- {
- var result = syntaxTree.GetClassifiedSpans();
- return result.Select(item =>
- {
- return new ClassifiedSpan(
- item.Span,
- item.BlockSpan,
- (SpanKind)item.SpanKind,
- (BlockKind)item.BlockKind,
- (AcceptedCharacters)item.AcceptedCharacters);
- }).ToArray();
- }
-
- public override IReadOnlyList GetTagHelperSpans(RazorSyntaxTree syntaxTree)
- {
- var result = syntaxTree.GetTagHelperSpans();
- return result.Select(item => new TagHelperSpan(item.Span, item.Binding)).ToArray();
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs
deleted file mode 100644
index 1c53c97a4454..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs
+++ /dev/null
@@ -1,297 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Diagnostics;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(TagHelperCompletionService))]
- internal class DefaultTagHelperCompletionService : TagHelperCompletionService
- {
- private readonly TagHelperFactsService _tagHelperFactsService;
- private static readonly HashSet _emptyHashSet = new HashSet();
-
- [ImportingConstructor]
- public DefaultTagHelperCompletionService(TagHelperFactsService tagHelperFactsService)
- {
- if (tagHelperFactsService == null)
- {
- throw new ArgumentNullException(nameof(tagHelperFactsService));
- }
-
- _tagHelperFactsService = tagHelperFactsService;
- }
-
- // This API attempts to understand a users context as they're typing in a Razor file to provide TagHelper based attribute IntelliSense.
- //
- // Scenarios for TagHelper attribute IntelliSense follows:
- // 1. TagHelperDescriptor's have matching required attribute names
- // -> Provide IntelliSense for the required attributes of those descriptors to lead users towards a TagHelperified element.
- // 2. TagHelperDescriptor entirely applies to current element. Tag name, attributes, everything is fulfilled.
- // -> Provide IntelliSense for the bound attributes for the applied descriptors.
- //
- // Within each of the above scenarios if an attribute completion has a corresponding bound attribute we associate it with the corresponding
- // BoundAttributeDescriptor. By doing this a user can see what C# type a TagHelper expects for the attribute.
- public override AttributeCompletionResult GetAttributeCompletions(AttributeCompletionContext completionContext)
- {
- if (completionContext == null)
- {
- throw new ArgumentNullException(nameof(completionContext));
- }
-
- var attributeCompletions = completionContext.ExistingCompletions.ToDictionary(
- completion => completion,
- _ => new HashSet(),
- StringComparer.OrdinalIgnoreCase);
-
- var documentContext = completionContext.DocumentContext;
- var descriptorsForTag = _tagHelperFactsService.GetTagHelpersGivenTag(documentContext, completionContext.CurrentTagName, completionContext.CurrentParentTagName);
- if (descriptorsForTag.Count == 0)
- {
- // If the current tag has no possible descriptors then we can't have any additional attributes.
- var defaultResult = AttributeCompletionResult.Create(attributeCompletions);
- return defaultResult;
- }
-
- var prefix = documentContext.Prefix ?? string.Empty;
- Debug.Assert(completionContext.CurrentTagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase));
-
- var applicableTagHelperBinding = _tagHelperFactsService.GetTagHelperBinding(
- documentContext,
- completionContext.CurrentTagName,
- completionContext.Attributes,
- completionContext.CurrentParentTagName,
- completionContext.CurrentParentIsTagHelper);
-
- var applicableDescriptors = applicableTagHelperBinding?.Descriptors ?? Enumerable.Empty();
- var unprefixedTagName = completionContext.CurrentTagName.Substring(prefix.Length);
-
- if (!completionContext.InHTMLSchema(unprefixedTagName) &&
- applicableDescriptors.All(descriptor => descriptor.TagOutputHint == null))
- {
- // This isn't a known HTML tag and no descriptor has an output element hint. Remove all previous completions.
- attributeCompletions.Clear();
- }
-
- for (var i = 0; i < descriptorsForTag.Count; i++)
- {
- var descriptor = descriptorsForTag[i];
-
- if (applicableDescriptors.Contains(descriptor))
- {
- foreach (var attributeDescriptor in descriptor.BoundAttributes)
- {
- UpdateCompletions(attributeDescriptor.Name, attributeDescriptor);
- }
- }
- else
- {
- var htmlNameToBoundAttribute = descriptor.BoundAttributes.ToDictionary(attribute => attribute.Name, StringComparer.OrdinalIgnoreCase);
-
- foreach (var rule in descriptor.TagMatchingRules)
- {
- foreach (var requiredAttribute in rule.Attributes)
- {
- if (htmlNameToBoundAttribute.TryGetValue(requiredAttribute.Name, out var attributeDescriptor))
- {
- UpdateCompletions(requiredAttribute.Name, attributeDescriptor);
- }
- else
- {
- UpdateCompletions(requiredAttribute.Name, possibleDescriptor: null);
- }
- }
- }
- }
- }
-
- var completionResult = AttributeCompletionResult.Create(attributeCompletions);
- return completionResult;
-
- void UpdateCompletions(string attributeName, BoundAttributeDescriptor possibleDescriptor)
- {
- if (completionContext.Attributes.Any(attribute => string.Equals(attribute.Key, attributeName, StringComparison.OrdinalIgnoreCase)) &&
- (completionContext.CurrentAttributeName == null ||
- !string.Equals(attributeName, completionContext.CurrentAttributeName, StringComparison.OrdinalIgnoreCase)))
- {
- // Attribute is already present on this element and it is not the attribute in focus.
- // It shouldn't exist in the completion list.
- return;
- }
-
- if (!attributeCompletions.TryGetValue(attributeName, out var rules))
- {
- rules = new HashSet();
- attributeCompletions[attributeName] = rules;
- }
-
- if (possibleDescriptor != null)
- {
- rules.Add(possibleDescriptor);
- }
- }
- }
-
- public override ElementCompletionResult GetElementCompletions(ElementCompletionContext completionContext)
- {
- if (completionContext == null)
- {
- throw new ArgumentNullException(nameof(completionContext));
- }
-
- var elementCompletions = new Dictionary>(StringComparer.OrdinalIgnoreCase);
-
- AddAllowedChildrenCompletions(completionContext, elementCompletions);
-
- if (elementCompletions.Count > 0)
- {
- // If the containing element is already a TagHelper and only allows certain children.
- var emptyResult = ElementCompletionResult.Create(elementCompletions);
- return emptyResult;
- }
-
- elementCompletions = completionContext.ExistingCompletions.ToDictionary(
- completion => completion,
- _ => new HashSet(),
- StringComparer.OrdinalIgnoreCase);
-
- var catchAllDescriptors = new HashSet();
- var prefix = completionContext.DocumentContext.Prefix ?? string.Empty;
- var possibleChildDescriptors = _tagHelperFactsService.GetTagHelpersGivenParent(completionContext.DocumentContext, completionContext.ContainingTagName);
- foreach (var possibleDescriptor in possibleChildDescriptors)
- {
- var addRuleCompletions = false;
- var outputHint = possibleDescriptor.TagOutputHint;
-
- foreach (var rule in possibleDescriptor.TagMatchingRules)
- {
- if (!TagHelperMatchingConventions.SatisfiesParentTag(completionContext.ContainingTagName, rule))
- {
- continue;
- }
-
- if (rule.TagName == TagHelperMatchingConventions.ElementCatchAllName)
- {
- catchAllDescriptors.Add(possibleDescriptor);
- }
- else if (elementCompletions.ContainsKey(rule.TagName))
- {
- addRuleCompletions = true;
- }
- else if (outputHint != null)
- {
- // If the current descriptor has an output hint we need to make sure it shows up only when its output hint would normally show up.
- // Example: We have a MyTableTagHelper that has an output hint of "table" and a MyTrTagHelper that has an output hint of "tr".
- // If we try typing in a situation like this: |
- // We'd expect to only get "my-table" as a completion because the "body" tag doesn't allow "tr" tags.
- addRuleCompletions = elementCompletions.ContainsKey(outputHint);
- }
- else if (!completionContext.InHTMLSchema(rule.TagName))
- {
- // If there is an unknown HTML schema tag that doesn't exist in the current completion we should add it. This happens for
- // TagHelpers that target non-schema oriented tags.
- addRuleCompletions = true;
- }
-
- if (addRuleCompletions)
- {
- UpdateCompletions(prefix + rule.TagName, possibleDescriptor);
- }
- }
- }
-
- // We needed to track all catch-alls and update their completions after all other completions have been completed.
- // This way, any TagHelper added completions will also have catch-alls listed under their entries.
- foreach (var catchAllDescriptor in catchAllDescriptors)
- {
- foreach (var completionTagName in elementCompletions.Keys)
- {
- if (elementCompletions[completionTagName].Count > 0 ||
- !string.IsNullOrEmpty(prefix) && completionTagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
- {
- // The current completion either has other TagHelper's associated with it or is prefixed with a non-empty
- // TagHelper prefix.
- UpdateCompletions(completionTagName, catchAllDescriptor);
- }
- }
- }
-
- var result = ElementCompletionResult.Create(elementCompletions);
- return result;
-
- void UpdateCompletions(string tagName, TagHelperDescriptor possibleDescriptor)
- {
- if (!elementCompletions.TryGetValue(tagName, out var existingRuleDescriptors))
- {
- existingRuleDescriptors = new HashSet();
- elementCompletions[tagName] = existingRuleDescriptors;
- }
-
- existingRuleDescriptors.Add(possibleDescriptor);
- }
- }
-
- private void AddAllowedChildrenCompletions(
- ElementCompletionContext completionContext,
- Dictionary> elementCompletions)
- {
- if (completionContext.ContainingTagName == null)
- {
- // If we're at the root then there's no containing TagHelper to specify allowed children.
- return;
- }
-
- var prefix = completionContext.DocumentContext.Prefix ?? string.Empty;
-
- var binding = _tagHelperFactsService.GetTagHelperBinding(
- completionContext.DocumentContext,
- completionContext.ContainingTagName,
- completionContext.Attributes,
- completionContext.ContainingParentTagName,
- completionContext.ContainingParentIsTagHelper);
-
- if (binding == null)
- {
- // Containing tag is not a TagHelper; therefore, it allows any children.
- return;
- }
-
- foreach (var descriptor in binding.Descriptors)
- {
- foreach (var childTag in descriptor.AllowedChildTags)
- {
- var prefixedName = string.Concat(prefix, childTag.Name);
- var descriptors = _tagHelperFactsService.GetTagHelpersGivenTag(
- completionContext.DocumentContext,
- prefixedName,
- completionContext.ContainingTagName);
-
- if (descriptors.Count == 0)
- {
- if (!elementCompletions.ContainsKey(prefixedName))
- {
- elementCompletions[prefixedName] = _emptyHashSet;
- }
-
- continue;
- }
-
- if (!elementCompletions.TryGetValue(prefixedName, out var existingRuleDescriptors))
- {
- existingRuleDescriptors = new HashSet();
- elementCompletions[prefixedName] = existingRuleDescriptors;
- }
-
- existingRuleDescriptors.UnionWith(descriptors);
- }
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs
deleted file mode 100644
index 1d23ce02317f..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(TagHelperFactsService))]
- internal class DefaultTagHelperFactsService : TagHelperFactsService
- {
- public override TagHelperBinding GetTagHelperBinding(
- TagHelperDocumentContext documentContext,
- string tagName,
- IEnumerable> attributes,
- string parentTag,
- bool parentIsTagHelper)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- if (tagName == null)
- {
- throw new ArgumentNullException(nameof(tagName));
- }
-
- if (attributes == null)
- {
- throw new ArgumentNullException(nameof(attributes));
- }
-
- var descriptors = documentContext.TagHelpers;
- if (descriptors == null || descriptors.Count == 0)
- {
- return null;
- }
-
- var prefix = documentContext.Prefix;
- var tagHelperBinder = new TagHelperBinder(prefix, descriptors);
- var binding = tagHelperBinder.GetBinding(tagName, attributes.ToList(), parentTag, parentIsTagHelper);
-
- return binding;
- }
-
- public override IEnumerable GetBoundTagHelperAttributes(
- TagHelperDocumentContext documentContext,
- string attributeName,
- TagHelperBinding binding)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- if (attributeName == null)
- {
- throw new ArgumentNullException(nameof(attributeName));
- }
-
- if (binding == null)
- {
- throw new ArgumentNullException(nameof(binding));
- }
-
- var matchingBoundAttributes = new List();
- foreach (var descriptor in binding.Descriptors)
- {
- foreach (var boundAttributeDescriptor in descriptor.BoundAttributes)
- {
- if (TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, boundAttributeDescriptor))
- {
- matchingBoundAttributes.Add(boundAttributeDescriptor);
-
- // Only one bound attribute can match an attribute
- break;
- }
- }
- }
-
- return matchingBoundAttributes;
- }
-
- public override IReadOnlyList GetTagHelpersGivenTag(
- TagHelperDocumentContext documentContext,
- string tagName,
- string parentTag)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- if (tagName == null)
- {
- throw new ArgumentNullException(nameof(tagName));
- }
-
- var matchingDescriptors = new List();
- var descriptors = documentContext?.TagHelpers;
- if (descriptors?.Count == 0)
- {
- return matchingDescriptors;
- }
-
- var prefix = documentContext.Prefix ?? string.Empty;
- if (!tagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
- {
- // Can't possibly match TagHelpers, it doesn't start with the TagHelperPrefix.
- return matchingDescriptors;
- }
-
- var tagNameWithoutPrefix = tagName.Substring(prefix.Length);
- for (var i = 0; i < descriptors.Count; i++)
- {
- var descriptor = descriptors[i];
- foreach (var rule in descriptor.TagMatchingRules)
- {
- if (TagHelperMatchingConventions.SatisfiesTagName(tagNameWithoutPrefix, rule) &&
- TagHelperMatchingConventions.SatisfiesParentTag(parentTag, rule))
- {
- matchingDescriptors.Add(descriptor);
- break;
- }
- }
- }
-
- return matchingDescriptors;
- }
-
- public override IReadOnlyList GetTagHelpersGivenParent(TagHelperDocumentContext documentContext, string parentTag)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- var matchingDescriptors = new List();
- var descriptors = documentContext?.TagHelpers;
- if (descriptors?.Count == 0)
- {
- return matchingDescriptors;
- }
-
- for (var i = 0; i < descriptors.Count; i++)
- {
- var descriptor = descriptors[i];
- foreach (var rule in descriptor.TagMatchingRules)
- {
- if (TagHelperMatchingConventions.SatisfiesParentTag(parentTag, rule))
- {
- matchingDescriptors.Add(descriptor);
- break;
- }
- }
- }
-
- return matchingDescriptors;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs
deleted file mode 100644
index 400a0ce2b8c3..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultTagHelperResolver : TagHelperResolver
- {
- public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default)
- {
- if (project == null)
- {
- throw new ArgumentNullException(nameof(project));
- }
-
- if (project.Configuration == null || project.WorkspaceProject == null)
- {
- return Task.FromResult(TagHelperResolutionResult.Empty);
- }
-
- return GetTagHelpersAsync(project, project.GetProjectEngine());
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs
deleted file mode 100644
index 50e2e9617929..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(TagHelperResolver), RazorLanguage.Name, ServiceLayer.Default)]
- internal class DefaultTagHelperResolverFactory : ILanguageServiceFactory
- {
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- return new DefaultTagHelperResolver();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs
deleted file mode 100644
index a9df7a9c45fe..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(TextBufferCodeDocumentProvider))]
- internal class DefaultTextBufferCodeDocumentProvider : TextBufferCodeDocumentProvider
- {
- public override bool TryGetFromBuffer(ITextBuffer textBuffer, out RazorCodeDocument codeDocument)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out VisualStudioRazorParser parser) && parser.CodeDocument != null)
- {
- codeDocument = parser.CodeDocument;
- return true;
- }
-
- codeDocument = null;
- return false;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs
deleted file mode 100644
index 22efa0ec08b5..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.ComponentModel.Composition;
-using System.Linq;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Projection;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [System.Composition.Shared]
- [Export(typeof(RazorTextBufferProvider))]
- internal class DefaultTextBufferProvider : RazorTextBufferProvider
- {
- private readonly IBufferGraphFactoryService _bufferGraphService;
-
- [ImportingConstructor]
- public DefaultTextBufferProvider(IBufferGraphFactoryService bufferGraphService)
- {
- if (bufferGraphService == null)
- {
- throw new ArgumentNullException(nameof(bufferGraphService));
- }
-
- _bufferGraphService = bufferGraphService;
- }
-
- public override bool TryGetFromDocument(TextDocument document, out ITextBuffer textBuffer)
- {
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- textBuffer = null;
-
- if (!document.TryGetText(out var sourceText))
- {
- // Could not retrieve source text from the document. We have no way have locating an ITextBuffer.
- return false;
- }
-
- var container = sourceText.Container;
- ITextBuffer buffer;
- try
- {
- buffer = container.GetTextBuffer();
- }
- catch (ArgumentException)
- {
- // The source text container was not built from an ITextBuffer.
- return false;
- }
-
- var bufferGraph = _bufferGraphService.CreateBufferGraph(buffer);
- var razorBuffer = bufferGraph.GetRazorBuffers().FirstOrDefault();
-
- if (razorBuffer == null)
- {
- // Could not find a text buffer associated with the text document.
- return false;
- }
-
- textBuffer = razorBuffer;
- return true;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs
deleted file mode 100644
index 02311c217bee..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultVisualStudioDocumentTracker : VisualStudioDocumentTracker
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly string _filePath;
- private readonly string _projectPath;
- private readonly ProjectSnapshotManager _projectManager;
- private readonly WorkspaceEditorSettings _workspaceEditorSettings;
- private readonly ITextBuffer _textBuffer;
- private readonly ImportDocumentManager _importDocumentManager;
- private readonly List _textViews;
- private readonly Workspace _workspace;
- private bool _isSupportedProject;
- private ProjectSnapshot _projectSnapshot;
- private int _subscribeCount;
-
- // Only allow a single tag helper computation task at a time.
- private (ProjectSnapshot project, Task task) _computingTagHelpers;
-
- // Stores the result from the last time we computed tag helpers.
- private IReadOnlyList _tagHelpers;
-
- public override event EventHandler ContextChanged;
-
- public DefaultVisualStudioDocumentTracker(
- ForegroundDispatcher dispatcher,
- string filePath,
- string projectPath,
- ProjectSnapshotManager projectManager,
- WorkspaceEditorSettings workspaceEditorSettings,
- Workspace workspace,
- ITextBuffer textBuffer,
- ImportDocumentManager importDocumentManager)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (string.IsNullOrEmpty(filePath))
- {
- throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath));
- }
-
- if (projectPath == null)
- {
- throw new ArgumentNullException(nameof(projectPath));
- }
-
- if (projectManager == null)
- {
- throw new ArgumentNullException(nameof(projectManager));
- }
-
- if (workspaceEditorSettings == null)
- {
- throw new ArgumentNullException(nameof(workspaceEditorSettings));
- }
-
- if (workspace == null)
- {
- throw new ArgumentNullException(nameof(workspace));
- }
-
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (importDocumentManager == null)
- {
- throw new ArgumentNullException(nameof(importDocumentManager));
- }
-
- _foregroundDispatcher = dispatcher;
- _filePath = filePath;
- _projectPath = projectPath;
- _projectManager = projectManager;
- _workspaceEditorSettings = workspaceEditorSettings;
- _textBuffer = textBuffer;
- _importDocumentManager = importDocumentManager;
- _workspace = workspace; // For now we assume that the workspace is the always default VS workspace.
-
- _textViews = new List();
- _tagHelpers = Array.Empty();
- }
-
- public override RazorConfiguration Configuration => _projectSnapshot?.Configuration;
-
- public override EditorSettings EditorSettings => _workspaceEditorSettings.Current;
-
- public override IReadOnlyList TagHelpers => _tagHelpers;
-
- public override bool IsSupportedProject => _isSupportedProject;
-
- public override Project Project =>
- _projectSnapshot.WorkspaceProject == null ?
- null :
- _workspace.CurrentSolution.GetProject(_projectSnapshot.WorkspaceProject.Id);
-
- internal override ProjectSnapshot ProjectSnapshot => _projectSnapshot;
-
- public override ITextBuffer TextBuffer => _textBuffer;
-
- public override IReadOnlyList TextViews => _textViews;
-
- public override Workspace Workspace => _workspace;
-
- public override string FilePath => _filePath;
-
- public override string ProjectPath => _projectPath;
-
- public Task PendingTagHelperTask => _computingTagHelpers.task ?? Task.CompletedTask;
-
- internal void AddTextView(ITextView textView)
- {
- if (textView == null)
- {
- throw new ArgumentNullException(nameof(textView));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (!_textViews.Contains(textView))
- {
- _textViews.Add(textView);
- }
- }
-
- internal void RemoveTextView(ITextView textView)
- {
- if (textView == null)
- {
- throw new ArgumentNullException(nameof(textView));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_textViews.Contains(textView))
- {
- _textViews.Remove(textView);
- }
- }
-
- public override ITextView GetFocusedTextView()
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- for (var i = 0; i < TextViews.Count; i++)
- {
- if (TextViews[i].HasAggregateFocus)
- {
- return TextViews[i];
- }
- }
-
- return null;
- }
-
- public void Subscribe()
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_subscribeCount++ > 0)
- {
- return;
- }
-
- _projectSnapshot = _projectManager.GetOrCreateProject(_projectPath);
- _isSupportedProject = true;
-
- _projectManager.Changed += ProjectManager_Changed;
- _workspaceEditorSettings.Changed += EditorSettingsManager_Changed;
- _importDocumentManager.Changed += Import_Changed;
-
- _importDocumentManager.OnSubscribed(this);
-
- OnContextChanged(ContextChangeKind.ProjectChanged);
- }
-
- public void Unsubscribe()
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_subscribeCount == 0 || _subscribeCount-- > 1)
- {
- return;
- }
-
- _importDocumentManager.OnUnsubscribed(this);
-
- _projectManager.Changed -= ProjectManager_Changed;
- _workspaceEditorSettings.Changed -= EditorSettingsManager_Changed;
- _importDocumentManager.Changed -= Import_Changed;
-
- // Detached from project.
- _isSupportedProject = false;
- _projectSnapshot = null;
- OnContextChanged(kind: ContextChangeKind.ProjectChanged);
- }
-
- private void StartComputingTagHelpers()
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- Debug.Assert(_projectSnapshot != null);
- Debug.Assert(_computingTagHelpers.project == null && _computingTagHelpers.task == null);
-
- if (_projectSnapshot.TryGetTagHelpers(out var results))
- {
- _tagHelpers = results;
- OnContextChanged(ContextChangeKind.TagHelpersChanged);
- return;
- }
-
- // if we get here then we know the tag helpers aren't available, so force async for ease of testing
- var task = _projectSnapshot
- .GetTagHelpersAsync()
- .ContinueWith(TagHelpersUpdated, CancellationToken.None, TaskContinuationOptions.RunContinuationsAsynchronously, _foregroundDispatcher.ForegroundScheduler);
- _computingTagHelpers = (_projectSnapshot, task);
- }
-
- private void TagHelpersUpdated(Task> task)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- Debug.Assert(_computingTagHelpers.project != null && _computingTagHelpers.task != null);
-
- if (!_isSupportedProject)
- {
- return;
- }
-
- _tagHelpers = task.Exception == null ? task.Result : Array.Empty();
- OnContextChanged(ContextChangeKind.TagHelpersChanged);
-
- var projectHasChanges = _projectSnapshot != null && _projectSnapshot != _computingTagHelpers.project;
- _computingTagHelpers = (null, null);
-
- if (projectHasChanges)
- {
- // More changes, keep going.
- StartComputingTagHelpers();
- }
- }
-
- private void OnContextChanged(ContextChangeKind kind)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- var handler = ContextChanged;
- if (handler != null)
- {
- handler(this, new ContextChangeEventArgs(kind));
- }
-
- if (kind == ContextChangeKind.ProjectChanged &&
- _projectSnapshot != null &&
- _computingTagHelpers.project == null)
- {
- StartComputingTagHelpers();
- }
- }
-
- // Internal for testing
- internal void ProjectManager_Changed(object sender, ProjectChangeEventArgs e)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- if (_projectPath != null &&
- string.Equals(_projectPath, e.ProjectFilePath, StringComparison.OrdinalIgnoreCase))
- {
- // This will be the new snapshot unless the project was removed.
- _projectSnapshot = _projectManager.GetLoadedProject(e.ProjectFilePath);
-
- switch (e.Kind)
- {
- case ProjectChangeKind.DocumentAdded:
- case ProjectChangeKind.DocumentRemoved:
- case ProjectChangeKind.DocumentChanged:
-
- // Nothing to do.
- break;
-
- case ProjectChangeKind.ProjectAdded:
- case ProjectChangeKind.ProjectChanged:
-
- // Just an update
- OnContextChanged(ContextChangeKind.ProjectChanged);
- break;
-
- case ProjectChangeKind.ProjectRemoved:
-
- // Fall back to ephemeral project
- _projectSnapshot = _projectManager.GetOrCreateProject(ProjectPath);
- OnContextChanged(ContextChangeKind.ProjectChanged);
- break;
-
- default:
- throw new InvalidOperationException($"Unknown ProjectChangeKind {e.Kind}");
- }
- }
- }
-
- // Internal for testing
- internal void EditorSettingsManager_Changed(object sender, EditorSettingsChangedEventArgs args)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- OnContextChanged(ContextChangeKind.EditorSettingsChanged);
- }
-
- // Internal for testing
- internal void Import_Changed(object sender, ImportChangedEventArgs args)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- foreach (var path in args.AssociatedDocuments)
- {
- if (string.Equals(_filePath, path, StringComparison.OrdinalIgnoreCase))
- {
- OnContextChanged(ContextChangeKind.ImportsChanged);
- break;
- }
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs
deleted file mode 100644
index 5d04b9d479b9..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultVisualStudioDocumentTrackerFactory : VisualStudioDocumentTrackerFactory
- {
- private readonly ITextDocumentFactoryService _textDocumentFactory;
- private readonly ProjectPathProvider _projectPathProvider;
- private readonly Workspace _workspace;
- private readonly ImportDocumentManager _importDocumentManager;
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly ProjectSnapshotManager _projectManager;
- private readonly WorkspaceEditorSettings _workspaceEditorSettings;
-
- public DefaultVisualStudioDocumentTrackerFactory(
- ForegroundDispatcher foregroundDispatcher,
- ProjectSnapshotManager projectManager,
- WorkspaceEditorSettings workspaceEditorSettings,
- ProjectPathProvider projectPathProvider,
- ITextDocumentFactoryService textDocumentFactory,
- ImportDocumentManager importDocumentManager,
- Workspace workspace)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (projectManager == null)
- {
- throw new ArgumentNullException(nameof(projectManager));
- }
-
- if (workspaceEditorSettings == null)
- {
- throw new ArgumentNullException(nameof(workspaceEditorSettings));
- }
-
- if (projectPathProvider == null)
- {
- throw new ArgumentNullException(nameof(projectPathProvider));
- }
-
- if (textDocumentFactory == null)
- {
- throw new ArgumentNullException(nameof(textDocumentFactory));
- }
-
- if (importDocumentManager == null)
- {
- throw new ArgumentNullException(nameof(importDocumentManager));
- }
-
- if (workspace == null)
- {
- throw new ArgumentNullException(nameof(workspace));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _projectManager = projectManager;
- _workspaceEditorSettings = workspaceEditorSettings;
- _projectPathProvider = projectPathProvider;
- _textDocumentFactory = textDocumentFactory;
- _importDocumentManager = importDocumentManager;
- _workspace = workspace;
- }
-
- public override VisualStudioDocumentTracker Create(ITextBuffer textBuffer)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- if (!_textDocumentFactory.TryGetTextDocument(textBuffer, out var textDocument))
- {
- Debug.Fail("Text document should be available from the text buffer.");
- return null;
- }
-
- if (!_projectPathProvider.TryGetProjectPath(textBuffer, out var projectPath))
- {
- return null;
- }
-
- var filePath = textDocument.FilePath;
- var tracker = new DefaultVisualStudioDocumentTracker(_foregroundDispatcher, filePath, projectPath, _projectManager, _workspaceEditorSettings, _workspace, textBuffer, _importDocumentManager);
-
- return tracker;
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs
deleted file mode 100644
index eed3ca436e28..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(VisualStudioDocumentTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)]
- internal class DefaultVisualStudioDocumentTrackerFactoryFactory : ILanguageServiceFactory
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly ITextDocumentFactoryService _textDocumentFactory;
-
- [ImportingConstructor]
- public DefaultVisualStudioDocumentTrackerFactoryFactory(
- ForegroundDispatcher foregroundDispatcher,
- ITextDocumentFactoryService textDocumentFactory)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (textDocumentFactory == null)
- {
- throw new ArgumentNullException(nameof(textDocumentFactory));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _textDocumentFactory = textDocumentFactory;
- }
-
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- var projectManager = languageServices.GetRequiredService();
- var workspaceEditorSettings = languageServices.GetRequiredService();
- var importDocumentManager = languageServices.GetRequiredService();
-
- var projectPathProvider = languageServices.WorkspaceServices.GetRequiredService();
-
- return new DefaultVisualStudioDocumentTrackerFactory(
- _foregroundDispatcher,
- projectManager,
- workspaceEditorSettings,
- projectPathProvider,
- _textDocumentFactory,
- importDocumentManager,
- languageServices.WorkspaceServices.Workspace);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs
deleted file mode 100644
index 25d446febff7..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs
+++ /dev/null
@@ -1,450 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.AspNetCore.Razor.Language.Legacy;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-using Microsoft.Extensions.Internal;
-using Microsoft.VisualStudio.Text;
-using static Microsoft.VisualStudio.Editor.Razor.BackgroundParser;
-using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer;
-using Timer = System.Threading.Timer;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultVisualStudioRazorParser : VisualStudioRazorParser, IDisposable
- {
- public override event EventHandler DocumentStructureChanged;
-
- // Internal for testing.
- internal TimeSpan IdleDelay = TimeSpan.FromSeconds(3);
- internal Timer _idleTimer;
- internal BackgroundParser _parser;
- internal ChangeReference _latestChangeReference;
- internal RazorSyntaxTreePartialParser _partialParser;
-
- private readonly object IdleLock = new object();
- private readonly VisualStudioCompletionBroker _completionBroker;
- private readonly VisualStudioDocumentTracker _documentTracker;
- private readonly ForegroundDispatcher _dispatcher;
- private readonly ProjectSnapshotProjectEngineFactory _projectEngineFactory;
- private readonly ErrorReporter _errorReporter;
- private RazorProjectEngine _projectEngine;
- private RazorCodeDocument _codeDocument;
- private ITextSnapshot _snapshot;
- private bool _disposed;
-
- // For testing only
- internal DefaultVisualStudioRazorParser(RazorCodeDocument codeDocument)
- {
- _codeDocument = codeDocument;
- }
-
- public DefaultVisualStudioRazorParser(
- ForegroundDispatcher dispatcher,
- VisualStudioDocumentTracker documentTracker,
- ProjectSnapshotProjectEngineFactory projectEngineFactory,
- ErrorReporter errorReporter,
- VisualStudioCompletionBroker completionBroker)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (documentTracker == null)
- {
- throw new ArgumentNullException(nameof(documentTracker));
- }
-
- if (projectEngineFactory == null)
- {
- throw new ArgumentNullException(nameof(projectEngineFactory));
- }
-
- if (errorReporter == null)
- {
- throw new ArgumentNullException(nameof(errorReporter));
- }
-
- if (completionBroker == null)
- {
- throw new ArgumentNullException(nameof(completionBroker));
- }
-
- _dispatcher = dispatcher;
- _projectEngineFactory = projectEngineFactory;
- _errorReporter = errorReporter;
- _completionBroker = completionBroker;
- _documentTracker = documentTracker;
-
- _documentTracker.ContextChanged += DocumentTracker_ContextChanged;
- }
-
- public override string FilePath => _documentTracker.FilePath;
-
- public override RazorCodeDocument CodeDocument => _codeDocument;
-
- public override ITextSnapshot Snapshot => _snapshot;
-
- public override ITextBuffer TextBuffer => _documentTracker.TextBuffer;
-
- public override bool HasPendingChanges => _latestChangeReference != null;
-
- // Used in unit tests to ensure we can be notified when idle starts.
- internal ManualResetEventSlim NotifyForegroundIdleStart { get; set; }
-
- // Used in unit tests to ensure we can block background idle work.
- internal ManualResetEventSlim BlockBackgroundIdleWork { get; set; }
-
- public override void QueueReparse()
- {
- // Can be called from any thread
-
- if (_dispatcher.IsForegroundThread)
- {
- ReparseOnForeground(null);
- }
- else
- {
- Task.Factory.StartNew(ReparseOnForeground, null, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler);
- }
- }
-
- public void Dispose()
- {
- _dispatcher.AssertForegroundThread();
-
- StopParser();
-
- _documentTracker.ContextChanged -= DocumentTracker_ContextChanged;
-
- StopIdleTimer();
-
- _disposed = true;
- }
-
- // Internal for testing
- internal void DocumentTracker_ContextChanged(object sender, ContextChangeEventArgs args)
- {
- _dispatcher.AssertForegroundThread();
-
- if (!TryReinitializeParser())
- {
- return;
- }
-
- // We have a new parser, force a reparse to generate new document information. Note that this
- // only blocks until the reparse change has been queued.
- QueueReparse();
- }
-
- // Internal for testing
- internal bool TryReinitializeParser()
- {
- _dispatcher.AssertForegroundThread();
-
- StopParser();
-
- if (!_documentTracker.IsSupportedProject)
- {
- // Tracker is either starting up, tearing down or wrongfully instantiated.
- // Either way, the tracker can't act on its associated project, neither can we.
- return false;
- }
-
- StartParser();
-
- return true;
- }
-
- // Internal for testing
- internal void StartParser()
- {
- _dispatcher.AssertForegroundThread();
-
- // Make sure any tests use the real thing or a good mock. These tests can cause failures
- // that are hard to understand when this throws.
- Debug.Assert(_documentTracker.IsSupportedProject);
- Debug.Assert(_documentTracker.ProjectSnapshot != null);
-
- _projectEngine = _projectEngineFactory.Create(_documentTracker.ProjectSnapshot, ConfigureProjectEngine);
-
- Debug.Assert(_projectEngine != null);
- Debug.Assert(_projectEngine.Engine != null);
- Debug.Assert(_projectEngine.FileSystem != null);
-
- var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath);
- _parser = new BackgroundParser(_projectEngine, FilePath, projectDirectory);
- _parser.ResultsReady += OnResultsReady;
- _parser.Start();
-
- TextBuffer.Changed += TextBuffer_OnChanged;
- }
-
- // Internal for testing
- internal void StopParser()
- {
- _dispatcher.AssertForegroundThread();
-
- if (_parser != null)
- {
- // Detatch from the text buffer until we have a new parser to handle changes.
- TextBuffer.Changed -= TextBuffer_OnChanged;
-
- _parser.ResultsReady -= OnResultsReady;
- _parser.Dispose();
- _parser = null;
- }
- }
-
- // Internal for testing
- internal void StartIdleTimer()
- {
- _dispatcher.AssertForegroundThread();
-
- lock (IdleLock)
- {
- if (_idleTimer == null)
- {
- // Timer will fire after a fixed delay, but only once.
- _idleTimer = NonCapturingTimer.Create(state => ((DefaultVisualStudioRazorParser)state).Timer_Tick(), this, IdleDelay, Timeout.InfiniteTimeSpan);
- }
- }
- }
-
- // Internal for testing
- internal void StopIdleTimer()
- {
- // Can be called from any thread.
-
- lock (IdleLock)
- {
- if (_idleTimer != null)
- {
- _idleTimer.Dispose();
- _idleTimer = null;
- }
- }
- }
-
- private void TextBuffer_OnChanged(object sender, TextContentChangedEventArgs args)
- {
- _dispatcher.AssertForegroundThread();
-
- if (args.Changes.Count > 0)
- {
- // Idle timers are used to track provisional changes. Provisional changes only last for a single text change. After that normal
- // partial parsing rules apply (stop the timer).
- StopIdleTimer();
- }
-
- if (!args.TextChangeOccurred(out var changeInformation))
- {
- return;
- }
-
- var change = new SourceChange(changeInformation.firstChange.OldPosition, changeInformation.oldText.Length, changeInformation.newText);
- var snapshot = args.After;
- var result = PartialParseResultInternal.Rejected;
-
- using (_parser.SynchronizeMainThreadState())
- {
- // Check if we can partial-parse
- if (_partialParser != null && _parser.IsIdle)
- {
- result = _partialParser.Parse(change);
- }
- }
-
- // If partial parsing failed or there were outstanding parser tasks, start a full reparse
- if ((result & PartialParseResultInternal.Rejected) == PartialParseResultInternal.Rejected)
- {
- QueueChange(change, snapshot);
- }
-
- if ((result & PartialParseResultInternal.Provisional) == PartialParseResultInternal.Provisional)
- {
- StartIdleTimer();
- }
- }
-
- // Internal for testing
- internal void OnIdle(object state)
- {
- _dispatcher.AssertForegroundThread();
-
- if (_disposed)
- {
- return;
- }
-
- OnNotifyForegroundIdle();
-
- foreach (var textView in _documentTracker.TextViews)
- {
- if (_completionBroker.IsCompletionActive(textView))
- {
- // Completion list is still active, need to re-start timer.
- StartIdleTimer();
- return;
- }
- }
-
- QueueReparse();
- }
-
- // Internal for testing
- internal void ReparseOnForeground(object state)
- {
- _dispatcher.AssertForegroundThread();
-
- if (_disposed)
- {
- return;
- }
-
- var snapshot = TextBuffer.CurrentSnapshot;
- QueueChange(null, snapshot);
- }
-
- private void QueueChange(SourceChange change, ITextSnapshot snapshot)
- {
- _dispatcher.AssertForegroundThread();
-
- _latestChangeReference = _parser.QueueChange(change, snapshot);
- }
-
- private void OnNotifyForegroundIdle()
- {
- if (NotifyForegroundIdleStart != null)
- {
- NotifyForegroundIdleStart.Set();
- }
- }
-
- private void OnStartingBackgroundIdleWork()
- {
- if (BlockBackgroundIdleWork != null)
- {
- BlockBackgroundIdleWork.Wait();
- }
- }
-
- private void Timer_Tick()
- {
- try
- {
- _dispatcher.AssertBackgroundThread();
-
- OnStartingBackgroundIdleWork();
-
- StopIdleTimer();
-
- // We need to get back to the UI thread to properly check if a completion is active.
- Task.Factory.StartNew(OnIdle, null, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler);
- }
- catch (Exception ex)
- {
- // This is something totally unexpected, let's just send it over to the workspace.
- Task.Factory.StartNew(() => _errorReporter.ReportError(ex), CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler);
- }
- }
-
- private void OnResultsReady(object sender, BackgroundParserResultsReadyEventArgs args)
- {
- _dispatcher.AssertBackgroundThread();
-
- // Jump back to UI thread to notify structure changes.
- Task.Factory.StartNew(OnDocumentStructureChanged, args, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler);
- }
-
- // Internal for testing
- internal void OnDocumentStructureChanged(object state)
- {
- _dispatcher.AssertForegroundThread();
-
- if (_disposed)
- {
- return;
- }
-
- var backgroundParserArgs = (BackgroundParserResultsReadyEventArgs)state;
- if (_latestChangeReference == null || // extra hardening
- _latestChangeReference != backgroundParserArgs.ChangeReference)
- {
- // In the middle of parsing a newer change or about to parse a newer change.
- return;
- }
-
- if (backgroundParserArgs.ChangeReference.Snapshot != TextBuffer.CurrentSnapshot)
- {
- // Changes have impacted the snapshot after our we recorded our last change reference.
- // This can happen for a multitude of reasons, usually because of a user auto-completing
- // C# statements (causes multiple edits in quick succession). This ensures that our latest
- // parse corresponds to the current snapshot.
- QueueReparse();
- return;
- }
-
- _latestChangeReference = null;
- _codeDocument = backgroundParserArgs.CodeDocument;
- _snapshot = backgroundParserArgs.ChangeReference.Snapshot;
- _partialParser = new RazorSyntaxTreePartialParser(CodeDocument.GetSyntaxTree());
-
- var documentStructureChangedArgs = new DocumentStructureChangedEventArgs(
- backgroundParserArgs.ChangeReference.Change,
- backgroundParserArgs.ChangeReference.Snapshot,
- backgroundParserArgs.CodeDocument);
- DocumentStructureChanged?.Invoke(this, documentStructureChangedArgs);
- }
-
- private void ConfigureProjectEngine(RazorProjectEngineBuilder builder)
- {
- builder.Features.Add(new VisualStudioParserOptionsFeature(_documentTracker.EditorSettings));
- builder.Features.Add(new VisualStudioTagHelperFeature(_documentTracker.TagHelpers));
- }
-
- private class VisualStudioParserOptionsFeature : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature
- {
- private readonly EditorSettings _settings;
-
- public VisualStudioParserOptionsFeature(EditorSettings settings)
- {
- _settings = settings;
- }
-
- public int Order { get; set; }
-
- public void Configure(RazorCodeGenerationOptionsBuilder options)
- {
- options.IndentSize = _settings.IndentSize;
- options.IndentWithTabs = _settings.IndentWithTabs;
- }
- }
-
- private class VisualStudioTagHelperFeature : ITagHelperFeature
- {
- private readonly IReadOnlyList _tagHelpers;
-
- public VisualStudioTagHelperFeature(IReadOnlyList tagHelpers)
- {
- _tagHelpers = tagHelpers;
- }
-
- public RazorEngine Engine { get; set; }
-
- public IReadOnlyList GetDescriptors()
- {
- return _tagHelpers;
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs
deleted file mode 100644
index 8807802090b9..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultVisualStudioRazorParserFactory : VisualStudioRazorParserFactory
- {
- private readonly ForegroundDispatcher _dispatcher;
- private readonly ProjectSnapshotProjectEngineFactory _projectEngineFactory;
- private readonly VisualStudioCompletionBroker _completionBroker;
- private readonly ErrorReporter _errorReporter;
-
- public DefaultVisualStudioRazorParserFactory(
- ForegroundDispatcher dispatcher,
- ErrorReporter errorReporter,
- VisualStudioCompletionBroker completionBroker,
- ProjectSnapshotProjectEngineFactory projectEngineFactory)
- {
- if (dispatcher == null)
- {
- throw new ArgumentNullException(nameof(dispatcher));
- }
-
- if (errorReporter == null)
- {
- throw new ArgumentNullException(nameof(errorReporter));
- }
-
- if (completionBroker == null)
- {
- throw new ArgumentNullException(nameof(completionBroker));
- }
-
- if (projectEngineFactory == null)
- {
- throw new ArgumentNullException(nameof(projectEngineFactory));
- }
-
- _dispatcher = dispatcher;
- _errorReporter = errorReporter;
- _completionBroker = completionBroker;
- _projectEngineFactory = projectEngineFactory;
- }
-
- public override VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker)
- {
- if (documentTracker == null)
- {
- throw new ArgumentNullException(nameof(documentTracker));
- }
-
- _dispatcher.AssertForegroundThread();
-
- var parser = new DefaultVisualStudioRazorParser(
- _dispatcher,
- documentTracker,
- _projectEngineFactory,
- _errorReporter,
- _completionBroker);
- return parser;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs
deleted file mode 100644
index 4e0ff7406e2e..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(VisualStudioRazorParserFactory), RazorLanguage.Name, ServiceLayer.Default)]
- internal class DefaultVisualStudioRazorParserFactoryFactory : ILanguageServiceFactory
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
-
- [ImportingConstructor]
- public DefaultVisualStudioRazorParserFactoryFactory(ForegroundDispatcher foregroundDispatcher)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- }
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- var workspaceServices = languageServices.WorkspaceServices;
- var errorReporter = workspaceServices.GetRequiredService();
- var completionBroker = languageServices.GetRequiredService();
- var projectEngineFactory = workspaceServices.GetRequiredService();
-
- return new DefaultVisualStudioRazorParserFactory(
- _foregroundDispatcher,
- errorReporter,
- completionBroker,
- projectEngineFactory);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs
deleted file mode 100644
index 0e49fbb8f4b1..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Diagnostics;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- internal class DefaultWorkspaceEditorSettings : WorkspaceEditorSettings
- {
- private readonly EditorSettingsManager _editorSettingsManager;
- private readonly EventHandler _onChanged;
- private EventHandler _changed;
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private int _listenerCount = 0;
-
- public DefaultWorkspaceEditorSettings(ForegroundDispatcher foregroundDispatcher, EditorSettingsManager editorSettingsManager)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (editorSettingsManager == null)
- {
- throw new ArgumentNullException(nameof(editorSettingsManager));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _editorSettingsManager = editorSettingsManager;
- _onChanged = OnChanged;
- }
-
- public override event EventHandler Changed
- {
- add
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- _listenerCount++;
- _changed += value;
-
- if (_listenerCount == 1)
- {
- // We bind to the editor settings manager only when we have listeners to avoid leaking memory.
- // Basically we're relying on anyone listening to us to have an understanding of when they're going
- // to be torn down. In Razor's case this will just be the document tracker factory (which does know).
- AttachToEditorSettingsManager();
- }
- }
- remove
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- _listenerCount--;
- _changed -= value;
-
- if (_listenerCount == 0)
- {
- // We detatch from the editor settings manager when no one is listening to allow us to be garbage
- // collected in the case that the workspace is tearing down.
- DetachFromEditorSettingsManager();
- }
- }
- }
-
- // Internal for testing
- internal virtual void AttachToEditorSettingsManager()
- {
- _editorSettingsManager.Changed += _onChanged;
- }
-
- // Internal for testing
- internal virtual void DetachFromEditorSettingsManager()
- {
- _editorSettingsManager.Changed -= _onChanged;
- }
-
- public override EditorSettings Current => _editorSettingsManager.Current;
-
- // Internal for testing
- internal void OnChanged(object sender, EditorSettingsChangedEventArgs e)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- Debug.Assert(_changed != null, nameof(OnChanged) + " should not be invoked when there are no listeners.");
-
- var args = new EditorSettingsChangedEventArgs(Current);
- _changed?.Invoke(this, args);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs
deleted file mode 100644
index 6bc448b43fb6..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- [Shared]
- [ExportLanguageServiceFactory(typeof(WorkspaceEditorSettings), RazorLanguage.Name)]
- internal class DefaultWorkspaceEditorSettingsFactory : ILanguageServiceFactory
- {
- private readonly ForegroundDispatcher _foregroundDispatcher;
- private readonly EditorSettingsManager _editorSettingsManager;
-
- [ImportingConstructor]
- public DefaultWorkspaceEditorSettingsFactory(ForegroundDispatcher foregroundDispatcher, EditorSettingsManager editorSettingsManager)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (editorSettingsManager == null)
- {
- throw new ArgumentNullException(nameof(editorSettingsManager));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _editorSettingsManager = editorSettingsManager;
- }
-
- public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
- {
- if (languageServices == null)
- {
- throw new ArgumentNullException(nameof(languageServices));
- }
-
- return new DefaultWorkspaceEditorSettings(_foregroundDispatcher, _editorSettingsManager);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs
deleted file mode 100644
index 4cd5e5c7dc84..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.AspNetCore.Razor.Language;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public sealed class DocumentStructureChangedEventArgs : EventArgs
- {
- public DocumentStructureChangedEventArgs(
- SourceChange change,
- ITextSnapshot snapshot,
- RazorCodeDocument codeDocument)
- {
- SourceChange = change;
- Snapshot = snapshot;
- CodeDocument = codeDocument;
- }
-
- ///
- /// The which triggered the re-parse.
- ///
- public SourceChange SourceChange { get; }
-
- ///
- /// The text snapshot used in the re-parse.
- ///
- public ITextSnapshot Snapshot { get; }
-
- ///
- /// The result of the parsing and code generation.
- ///
- public RazorCodeDocument CodeDocument { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTracker.cs
deleted file mode 100644
index 95cfcfa5ebac..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTracker.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- // A noop implementation for non-ide cases
- internal class DefaultFileChangeTracker : FileChangeTracker
- {
- public override event EventHandler Changed;
-
- public DefaultFileChangeTracker(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- FilePath = filePath;
-
- GC.KeepAlive(Changed);
- }
-
- public override string FilePath { get; }
-
- public override void StartListening()
- {
- // Do nothing
- }
-
- public override void StopListening()
- {
- // Do nothing
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTrackerFactory.cs
deleted file mode 100644
index 6a982d119d80..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/DefaultFileChangeTrackerFactory.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Host.Mef;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- [ExportWorkspaceService(typeof(FileChangeTrackerFactory), layer: ServiceLayer.Editor)]
- internal class DefaultFileChangeTrackerFactory : FileChangeTrackerFactory
- {
- public override FileChangeTracker Create(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- return new DefaultFileChangeTracker(filePath);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocument.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocument.cs
deleted file mode 100644
index d31e8d008518..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocument.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- // Tracks the mutable state associated with a document - in contrast to DocumentSnapshot
- // which tracks the state at a point in time.
- internal sealed class EditorDocument : IDisposable
- {
- private readonly EditorDocumentManager _documentManager;
- private readonly FileChangeTracker _fileTracker;
- private readonly SnapshotChangeTracker _snapshotTracker;
- private readonly EventHandler _changedOnDisk;
- private readonly EventHandler _changedInEditor;
- private readonly EventHandler _opened;
- private readonly EventHandler _closed;
-
- private bool _disposed;
-
- public EditorDocument(
- EditorDocumentManager documentManager,
- string projectFilePath,
- string documentFilePath,
- TextLoader textLoader,
- FileChangeTracker fileTracker,
- ITextBuffer textBuffer,
- EventHandler changedOnDisk,
- EventHandler changedInEditor,
- EventHandler opened,
- EventHandler closed)
- {
- if (documentManager == null)
- {
- throw new ArgumentNullException(nameof(documentManager));
- }
-
- if (projectFilePath == null)
- {
- throw new ArgumentNullException(nameof(projectFilePath));
- }
-
- if (documentFilePath == null)
- {
- throw new ArgumentNullException(nameof(documentFilePath));
- }
-
- if (textLoader == null)
- {
- throw new ArgumentNullException(nameof(textLoader));
- }
-
- if (fileTracker == null)
- {
- throw new ArgumentNullException(nameof(fileTracker));
- }
-
- _documentManager = documentManager;
- ProjectFilePath = projectFilePath;
- DocumentFilePath = documentFilePath;
- TextLoader = textLoader;
- _fileTracker = fileTracker;
- _changedOnDisk = changedOnDisk;
- _changedInEditor = changedInEditor;
- _opened = opened;
- _closed = closed;
-
- _snapshotTracker = new SnapshotChangeTracker();
- _fileTracker.Changed += ChangeTracker_Changed;
-
- // Only one of these should be active at a time.
- if (textBuffer == null)
- {
- _fileTracker.StartListening();
- }
- else
- {
- _snapshotTracker.StartTracking(textBuffer);
-
- EditorTextBuffer = textBuffer;
- EditorTextContainer = textBuffer.AsTextContainer();
- EditorTextContainer.TextChanged += TextContainer_Changed;
- }
- }
-
- public string ProjectFilePath { get; }
-
- public string DocumentFilePath { get; }
-
- public bool IsOpenInEditor => EditorTextBuffer != null;
-
- public SourceTextContainer EditorTextContainer { get; private set; }
-
- public ITextBuffer EditorTextBuffer { get; private set; }
-
- public TextLoader TextLoader { get; }
-
- public void ProcessOpen(ITextBuffer textBuffer)
- {
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- _fileTracker.StopListening();
-
- _snapshotTracker.StartTracking(textBuffer);
- EditorTextBuffer = textBuffer;
- EditorTextContainer = textBuffer.AsTextContainer();
- EditorTextContainer.TextChanged += TextContainer_Changed;
-
- _opened?.Invoke(this, EventArgs.Empty);
- }
-
- public void ProcessClose()
- {
- _closed?.Invoke(this, EventArgs.Empty);
-
- _snapshotTracker.StopTracking(EditorTextBuffer);
-
- EditorTextContainer.TextChanged -= TextContainer_Changed;
- EditorTextContainer = null;
- EditorTextBuffer = null;
-
- _fileTracker.StartListening();
- }
-
- private void ChangeTracker_Changed(object sender, FileChangeEventArgs e)
- {
- if (e.Kind == FileChangeKind.Changed)
- {
- _changedOnDisk?.Invoke(this, EventArgs.Empty);
- }
- }
-
- private void TextContainer_Changed(object sender, TextChangeEventArgs e)
- {
- _changedInEditor?.Invoke(this, EventArgs.Empty);
- }
-
- public void Dispose()
- {
- if (!_disposed)
- {
- _fileTracker.Changed -= ChangeTracker_Changed;
- _fileTracker.StopListening();
-
- if (EditorTextBuffer != null)
- {
- _snapshotTracker.StopTracking(EditorTextBuffer);
- EditorTextBuffer = null;
- }
-
- if (EditorTextContainer != null)
- {
- EditorTextContainer.TextChanged -= TextContainer_Changed;
- EditorTextContainer = null;
- }
-
- _documentManager.RemoveDocument(this);
-
- _disposed = true;
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManager.cs
deleted file mode 100644
index 89f8745e6ca3..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManager.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Razor;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- internal abstract class EditorDocumentManager : IWorkspaceService
- {
- public abstract EditorDocument GetOrCreateDocument(
- DocumentKey key,
- EventHandler changedOnDisk,
- EventHandler changedInEditor,
- EventHandler opened,
- EventHandler closed);
-
- public abstract bool TryGetDocument(DocumentKey key, out EditorDocument document);
-
- public abstract bool TryGetMatchingDocuments(string filePath, out EditorDocument[] documents);
-
- public abstract void RemoveDocument(EditorDocument document);
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerBase.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerBase.cs
deleted file mode 100644
index 34abfe79d2ca..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerBase.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- // Similar to the DocumentProvider in dotnet/Roslyn - but simplified quite a bit to remove
- // concepts that we don't need. Responsible for providing data about text changes for documents
- // and editor open/closed state.
- internal abstract class EditorDocumentManagerBase : EditorDocumentManager
- {
- private readonly FileChangeTrackerFactory _fileChangeTrackerFactory;
- private readonly ForegroundDispatcher _foregroundDispatcher;
-
- private readonly Dictionary _documents;
- private readonly Dictionary> _documentsByFilePath;
- protected readonly object _lock;
-
- public EditorDocumentManagerBase(
- ForegroundDispatcher foregroundDispatcher,
- FileChangeTrackerFactory fileChangeTrackerFactory)
- {
- if (foregroundDispatcher == null)
- {
- throw new ArgumentNullException(nameof(foregroundDispatcher));
- }
-
- if (fileChangeTrackerFactory == null)
- {
- throw new ArgumentNullException(nameof(fileChangeTrackerFactory));
- }
-
- _foregroundDispatcher = foregroundDispatcher;
- _fileChangeTrackerFactory = fileChangeTrackerFactory;
-
- _documents = new Dictionary();
- _documentsByFilePath = new Dictionary>(FilePathComparer.Instance);
- _lock = new object();
- }
-
- protected ForegroundDispatcher ForegroundDispatcher => _foregroundDispatcher;
-
- protected abstract ITextBuffer GetTextBufferForOpenDocument(string filePath);
-
- protected abstract void OnDocumentOpened(EditorDocument document);
-
- protected abstract void OnDocumentClosed(EditorDocument document);
-
- public sealed override bool TryGetDocument(DocumentKey key, out EditorDocument document)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (_lock)
- {
- return _documents.TryGetValue(key, out document);
- }
- }
-
- public sealed override bool TryGetMatchingDocuments(string filePath, out EditorDocument[] documents)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (_lock)
- {
- if (!_documentsByFilePath.TryGetValue(filePath, out var keys))
- {
- documents = null;
- return false;
- }
-
- documents = new EditorDocument[keys.Count];
- for (var i = 0; i < keys.Count; i++)
- {
- documents[i] = _documents[keys[i]];
- }
-
- return true;
- }
- }
-
- public sealed override EditorDocument GetOrCreateDocument(
- DocumentKey key,
- EventHandler changedOnDisk,
- EventHandler changedInEditor,
- EventHandler opened,
- EventHandler closed)
- {
- _foregroundDispatcher.AssertForegroundThread();
-
- EditorDocument document;
-
- lock (_lock)
- {
- if (TryGetDocument(key, out document))
- {
- return document;
- }
-
- // Check if the document is already open and initialized, and associate a buffer if possible.
- var textBuffer = GetTextBufferForOpenDocument(key.DocumentFilePath);
- document = new EditorDocument(
- this,
- key.ProjectFilePath,
- key.DocumentFilePath,
- new FileTextLoader(key.DocumentFilePath, defaultEncoding: null),
- _fileChangeTrackerFactory.Create(key.DocumentFilePath),
- textBuffer,
- changedOnDisk,
- changedInEditor,
- opened,
- closed);
-
- _documents.Add(key, document);
-
- if (!_documentsByFilePath.TryGetValue(key.DocumentFilePath, out var documents))
- {
- documents = new List();
- _documentsByFilePath.Add(key.DocumentFilePath, documents);
- }
-
- if (!documents.Contains(key))
- {
- documents.Add(key);
- }
-
- if (document.IsOpenInEditor)
- {
- OnDocumentOpened(document);
- }
-
- return document;
- }
- }
-
- protected void DocumentOpened(string filePath, ITextBuffer textBuffer)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- if (textBuffer == null)
- {
- throw new ArgumentNullException(nameof(textBuffer));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (_lock)
- {
- if (TryGetMatchingDocuments(filePath, out var documents))
- {
- for (var i = 0; i < documents.Length; i++)
- {
- var document = documents[i];
-
- document.ProcessOpen(textBuffer);
- OnDocumentOpened(document);
- }
- }
- }
- }
-
- protected void DocumentClosed(string filePath)
- {
- if (filePath == null)
- {
- throw new ArgumentNullException(nameof(filePath));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- lock (_lock)
- {
- if (TryGetMatchingDocuments(filePath, out var documents))
- {
- for (var i = 0; i < documents.Length; i++)
- {
- var document = documents[i];
-
- document.ProcessClose();
- OnDocumentClosed(document);
- }
- }
- }
- }
-
- public sealed override void RemoveDocument(EditorDocument document)
- {
- if (document == null)
- {
- throw new ArgumentNullException(nameof(document));
- }
-
- _foregroundDispatcher.AssertForegroundThread();
-
- var key = new DocumentKey(document.ProjectFilePath, document.DocumentFilePath);
- if (_documentsByFilePath.TryGetValue(document.DocumentFilePath, out var documents))
- {
- documents.Remove(key);
-
- if (documents.Count == 0)
- {
- _documentsByFilePath.Remove(document.DocumentFilePath);
- }
- }
-
- _documents.Remove(key);
-
- if (document.IsOpenInEditor)
- {
- OnDocumentClosed(document);
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerListener.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerListener.cs
deleted file mode 100644
index 284df8859053..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/EditorDocumentManagerListener.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Composition;
-using Microsoft.CodeAnalysis.Razor;
-using Microsoft.CodeAnalysis.Razor.ProjectSystem;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- // Hooks up the document manager to project snapshot events. The project snapshot manager
- // tracks the existance of projects/files and the the document manager watches for changes.
- //
- // This class forwards notifications in both directions.
- [Export(typeof(ProjectSnapshotChangeTrigger))]
- internal class EditorDocumentManagerListener : ProjectSnapshotChangeTrigger
- {
- private readonly EventHandler _onChangedOnDisk;
- private readonly EventHandler _onChangedInEditor;
- private readonly EventHandler _onOpened;
- private readonly EventHandler _onClosed;
-
- private EditorDocumentManager _documentManager;
- private ProjectSnapshotManagerBase _projectManager;
-
- [ImportingConstructor]
- public EditorDocumentManagerListener()
- {
- _onChangedOnDisk = Document_ChangedOnDisk;
- _onChangedInEditor = Document_ChangedInEditor;
- _onOpened = Document_Opened;
- _onClosed = Document_Closed;
- }
-
- // For testing purposes only.
- internal EditorDocumentManagerListener(EditorDocumentManager documentManager, EventHandler onChangedOnDisk, EventHandler onChangedInEditor, EventHandler onOpened, EventHandler onClosed)
- {
- _documentManager = documentManager;
- _onChangedOnDisk = onChangedOnDisk;
- _onChangedInEditor = onChangedInEditor;
- _onOpened = onOpened;
- _onClosed = onClosed;
- }
-
- public override void Initialize(ProjectSnapshotManagerBase projectManager)
- {
- if (projectManager == null)
- {
- throw new ArgumentNullException(nameof(projectManager));
- }
-
- _projectManager = projectManager;
- _documentManager = projectManager.Workspace.Services.GetRequiredService();
-
- _projectManager.Changed += ProjectManager_Changed;
- }
-
- // Internal for testing.
- internal void ProjectManager_Changed(object sender, ProjectChangeEventArgs e)
- {
- switch (e.Kind)
- {
- case ProjectChangeKind.DocumentAdded:
- {
- var key = new DocumentKey(e.ProjectFilePath, e.DocumentFilePath);
- var document = _documentManager.GetOrCreateDocument(key, _onChangedOnDisk, _onChangedInEditor, _onOpened, _onClosed);
- if (document.IsOpenInEditor)
- {
- _onOpened(document, EventArgs.Empty);
- }
-
- break;
- }
-
- case ProjectChangeKind.DocumentRemoved:
- {
- // This class 'owns' the document entry so it's safe for us to dispose it.
- if (_documentManager.TryGetDocument(new DocumentKey(e.ProjectFilePath, e.DocumentFilePath), out var document))
- {
- document.Dispose();
- }
- break;
- }
- }
- }
-
- private void Document_ChangedOnDisk(object sender, EventArgs e)
- {
- var document = (EditorDocument)sender;
- _projectManager.DocumentChanged(document.ProjectFilePath, document.DocumentFilePath, document.TextLoader);
- }
-
- private void Document_ChangedInEditor(object sender, EventArgs e)
- {
- var document = (EditorDocument)sender;
- _projectManager.DocumentChanged(document.ProjectFilePath, document.DocumentFilePath, document.EditorTextContainer.CurrentText);
- }
-
- private void Document_Opened(object sender, EventArgs e)
- {
- var document = (EditorDocument)sender;
- _projectManager.DocumentOpened(document.ProjectFilePath, document.DocumentFilePath, document.EditorTextContainer.CurrentText);
- }
-
- private void Document_Closed(object sender, EventArgs e)
- {
- var document = (EditorDocument)sender;
- _projectManager.DocumentClosed(document.ProjectFilePath, document.DocumentFilePath, document.TextLoader);
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeEventArgs.cs
deleted file mode 100644
index b7541308d495..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeEventArgs.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- internal sealed class FileChangeEventArgs : EventArgs
- {
- public FileChangeEventArgs(string filePath, FileChangeKind kind)
- {
- FilePath = filePath;
- Kind = kind;
- }
-
- public string FilePath { get; }
-
- public FileChangeKind Kind { get; }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeKind.cs
deleted file mode 100644
index 7c3fff9d8f65..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeKind.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- internal enum FileChangeKind
- {
- Added,
- Removed,
- Changed,
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTracker.cs
deleted file mode 100644
index d34c42572aff..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTracker.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- internal abstract class FileChangeTracker
- {
- public abstract event EventHandler Changed;
-
- public abstract string FilePath { get; }
-
- public abstract void StartListening();
-
- public abstract void StopListening();
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTrackerFactory.cs
deleted file mode 100644
index febad8989011..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/FileChangeTrackerFactory.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.CodeAnalysis.Host;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- internal abstract class FileChangeTrackerFactory : IWorkspaceService
- {
- public abstract FileChangeTracker Create(string filePath);
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/SnapshotChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/SnapshotChangeTracker.cs
deleted file mode 100644
index 13a75d5ea7d3..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Documents/SnapshotChangeTracker.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.VisualStudio.Text;
-
-namespace Microsoft.VisualStudio.Editor.Razor.Documents
-{
- // See ReiteratedVersionSnapshotTracker in dotnet/Roslyn -- this is primarily here for the
- // side-effect of making sure the last 'reiterated' snapshot is retained in memory.
- //
- // Since we're interacting with the workspace in the same way, we're doing the same thing.
- internal class SnapshotChangeTracker
- {
- private ITextBuffer _textBuffer;
- private ITextSnapshot _snapshot;
-
- public void StartTracking(ITextBuffer buffer)
- {
- // buffer has changed. stop tracking old buffer
- if (_textBuffer != null && buffer != _textBuffer)
- {
- _textBuffer.ChangedHighPriority -= OnTextBufferChanged;
-
- _textBuffer = null;
- _snapshot = null;
- }
-
- // start tracking new buffer
- if (buffer != null && _snapshot == null)
- {
- _snapshot = buffer.CurrentSnapshot;
- _textBuffer = buffer;
-
- buffer.ChangedHighPriority += OnTextBufferChanged;
- }
- }
-
- public void StopTracking(ITextBuffer buffer)
- {
- if (_textBuffer == buffer && buffer != null && _snapshot != null)
- {
- buffer.ChangedHighPriority -= OnTextBufferChanged;
-
- _textBuffer = null;
- _snapshot = null;
- }
- }
-
- private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
- {
- if (sender is ITextBuffer buffer)
- {
- var snapshot = _snapshot;
- if (snapshot != null && snapshot.Version != null && e.AfterVersion != null &&
- snapshot.Version.ReiteratedVersionNumber < e.AfterVersion.ReiteratedVersionNumber)
- {
- _snapshot = e.After;
- }
- }
- }
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs
deleted file mode 100644
index c3e0399bde25..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using Microsoft.CodeAnalysis.Razor.Editor;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public abstract class EditorSettingsManager
- {
- public abstract event EventHandler Changed;
-
- public abstract EditorSettings Current { get; }
-
- public abstract void Update(EditorSettings updateSettings);
- }
-}
diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs
deleted file mode 100644
index 6d2c3965f590..000000000000
--- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Razor.Language;
-
-namespace Microsoft.VisualStudio.Editor.Razor
-{
- public sealed class ElementCompletionContext
- {
- public ElementCompletionContext(
- TagHelperDocumentContext documentContext,
- IEnumerable existingCompletions,
- string containingTagName,
- IEnumerable> attributes,
- string containingParentTagName,
- bool containingParentIsTagHelper,
- Func inHTMLSchema)
- {
- if (documentContext == null)
- {
- throw new ArgumentNullException(nameof(documentContext));
- }
-
- if (existingCompletions == null)
- {
- throw new ArgumentNullException(nameof(existingCompletions));
- }
-
- if (inHTMLSchema == null)
- {
- throw new ArgumentNullException(nameof(inHTMLSchema));
- }
-
- DocumentContext = documentContext;
- ExistingCompletions = existingCompletions;
- ContainingTagName = containingTagName;
- Attributes = attributes;
- ContainingParentTagName = containingParentTagName;
- ContainingParentIsTagHelper = containingParentIsTagHelper;
- InHTMLSchema = inHTMLSchema;
- }
-
- public TagHelperDocumentContext DocumentContext { get; }
-
- public IEnumerable ExistingCompletions { get; }
-
- public string ContainingTagName { get; }
-
- public IEnumerable> Attributes { get; }
-
- public string ContainingParentTagName { get; }
-
- public bool ContainingParentIsTagHelper { get; }
-
- public Func